Skip to content

[BUG]: address etag drift in resources #3291

@caulagi

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working as documented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions