[BUG]: Imported repos have drift on template item
Expected Behavior
My code works fine for creating new repos but if I import existing one it shows constant drift
~ resource "github_repository" "repo" {
id = "pizza"
name = "pizza"
# (36 unchanged attributes hidden)
+ template {
+ include_all_branches = false
+ owner = "XXX"
+ repository = "github-repo-template"
}
}
Plan: 0 to add, 1 to change, 0 to destroy.
They are not created from a template. Is there a way to prevent this without creating a different resource for these that are not based on template?
Actual Behavior
There is no way to set template after repo is created on blank but TF tries to do it
Terraform Version
Terraform v1.4.6 on linux_amd64
- provider registry.terraform.io/hashicorp/aws v3.76.1
- provider registry.terraform.io/integrations/github v6.5.0
Affected Resource(s)
github_repository
Terraform Configuration Files
resource "github_repository" "repo" {
name = var.name
...
topics = ["managed-by-terraform"]
template {
owner = "XXX"
repository = "github-repo-template"
include_all_branches = false
}
}
Steps to Reproduce
terraform plan
after a non templated repo is imported
Debug Output
Panic Output
Code of Conduct
- [x] I agree to follow this project's Code of Conduct
In a strange way after 2 TF apply commands the drift goes away
For a while, but always seems to come back eventually :/.
Also seeing this behaviour
I’ve experienced the same issue when creating a new repository from a template — the diff always appears.