terraform-provider-github
terraform-provider-github copied to clipboard
[BUG]: Already existing file commited by others will get overwritten although `ignore_changes` is set to `all`
Expected Behavior
When the file exists it should just skip over the file and do not propose any changes.
Actual Behavior
If the file was created via the Github App connected to tf, it will not propose any changes. However, if any other person added this file beforehand, terraform tries to create a new one (which fails, because I disabled overwriting the file)
Terraform Version
Terraform v1.9.5
on linux_amd64
+ provider registry.terraform.io/integrations/github v6.2.3
Affected Resource(s)
- github_repository_file
Terraform Configuration Files
resource "github_repository_file" "codeowners_file" {
file = ".github/CODEOWNERS"
repository = "test-repository"
content = "* @foo/bar"
commit_message = "Add CODEOWNERS file"
lifecycle {
ignore_changes = all
}
}
Steps to Reproduce
Happy path
-
terraform apply
-
terraform plan
Sad Path
- Create the file
.github/CODEOWNERS
in your test-repo - Run
terraform plan
You will see that terraform proposes creating this file a second time
Debug Output
No response
Panic Output
No response
Code of Conduct
- [X] I agree to follow this project's Code of Conduct