terraform-provider-github icon indicating copy to clipboard operation
terraform-provider-github copied to clipboard

[BUG]: Already existing file commited by others will get overwritten although `ignore_changes` is set to `all`

Open corsin-ragettli opened this issue 5 months ago • 0 comments

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

  1.   terraform apply
    
  2.  terraform plan
    

Sad Path

  1. Create the file .github/CODEOWNERS in your test-repo
  2. 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

corsin-ragettli avatar Aug 29 '24 14:08 corsin-ragettli