Skip to content

[BUG]: address etag drift in resources #3291

Closed

Description

@caulagi

Expected Behavior

terraform plan on code containing github_team_repository shouldn't contain changes to etags. This seems related to #2840 but github_team_repository was missed

Actual Behavior

terraform plan on code containing github_team_repository includes changes to etags

Terraform Version

terraform -v
Terraform v1.14.4
on darwin_arm64

  • provider registry.terraform.io/hashicorp/google v7.24.0
  • provider registry.terraform.io/integrations/github v6.11.1

Affected Resource(s)

  • github_team_repository
  • github_repository_deploy_key

Terraform Configuration Files

resource "github_repository" "terraform-test" {
  name = "terraform-test"

  visibility    = "private"
  allow_forking = false

  template {
    owner      = "<redacted>"
    repository = "<redacted>"
  }

  lifecycle {
    ignore_changes = [pages]
  }
}

resource "github_team_repository" "repo_maintainers" {
  team_id    = "cloudteam"
  repository = github_repository.terraform-test.name
  permission = "Maintain Plus"
}

Steps to Reproduce

Change any of the parameters to github_team_repository in the example above -

git diff
diff --git a/terraform-debug/main.tf b/terraform-debug/main.tf
index 7dc5c12..238d9b0 100644
--- a/terraform-debug/main.tf
+++ b/terraform-debug/main.tf
@@ -15,7 +15,7 @@ resource "github_repository" "terraform-test" {
 }

 resource "github_team_repository" "repo_maintainers" {
-  team_id    = "infosec"
+  team_id    = "cloudteam"
   repository = github_repository.terraform-test.name
   permission = "Maintain Plus"
 }

$ terraform plan
data.google_secret_manager_secret_version.github-org-app: Reading...
data.google_secret_manager_secret_version.github-org-app: Read complete after 1s [id=projects/164402708602/secrets/kivra-terraform-repo-creator-pem/versions/2]
github_repository.terraform-test: Refreshing state... [id=terraform-test]
github_team_repository.repo_maintainers: Refreshing state... [id=3621971:terraform-test]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # github_team_repository.repo_maintainers must be replaced
-/+ resource "github_team_repository" "repo_maintainers" {
      ~ etag       = "W/\"7a92613025eafbcc387d2e29c757cefd560cfa02f5a75bdf6a8d18669c84fa04\"" -> (known after apply)
      ~ id         = "3621971:terraform-test" -> (known after apply)
      ~ permission = "admin" -> "Maintain Plus"
      ~ team_id    = "infrasec" -> "cloudteam" # forces replacement
        # (1 unchanged attribute hidden)
    }

Plan: 1 to add, 0 to change, 1 to destroy.

Debug Output

Panic Output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    Type: Bug
    Status: Triage
    on Mar 19, 2026
  2. github-actions commented on Mar 19, 2026

    @github-actions

    👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

  3. deiga commented on Mar 19, 2026

    @deiga
    Collaborator

    @caulagi Thanks for raising this!
    I think you can use lifecycle.ignore_changes for now to get it out of your plan, until it's fixed.

    @stevehipwell @robert-crandall
    While addressing this is fairly simple, I wonder if we should make a decision for removing the etag fields and doing etag handling on a lower level

  4. caulagi commented on Mar 23, 2026

    @caulagi
    Author

    Thanks! its the same behaviour for github_repository_deploy_key . Should I create a separate issue for this or will this be handled as part of the refactoring you are suggesting @deiga ?

  5. caulagi commented on Mar 23, 2026

    @caulagi
    Author

    Forgot to mention that ignore_changes doesn't work for this bug and I get this warning instead -

    Warning: Redundant ignore_changes element
    
      on ../../modules/github-repo/main.tf line 26, in resource "github_team_repository" "repo_maintainers":
      26: resource "github_team_repository" "repo_maintainers" {
    
    Adding an attribute name to ignore_changes tells Terraform to ignore future
    changes to the argument in configuration after the object has been created,
    retaining the value originally configured.
    
    The attribute etag is decided by the provider alone and therefore there can
    be no configured value to compare with. Including this attribute in
    ignore_changes has no effect. Remove the attribute from ignore_changes to
    quiet this warning.
    
  6. deiga commented on Mar 23, 2026

    @deiga
    Collaborator

    Oh 🤦‍♂️
    Thanks for sharing that!

    I think we could rename this issue to something like "address etag drift in all resources" to cover both mentioned resources.

  7. changed the title [-][BUG]: github_team_repository doesn't ignore etags[/-] [+][BUG]: address etag drift in resources[/+] on Mar 23, 2026
  8. removed
    Status: Triage
    on Mar 24, 2026
  9. added a commit that references this issue on Mar 30, 2026
    23a52ec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions