Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permadiff in google_access_context_manager_service_perimeter #1176

Closed
pfilourenco opened this issue Feb 24, 2023 · 0 comments · Fixed by #1177
Closed

Permadiff in google_access_context_manager_service_perimeter #1176

pfilourenco opened this issue Feb 24, 2023 · 0 comments · Fixed by #1177

Comments

@pfilourenco
Copy link

Hi,

I'm using vpc-sc module and I have permanent diff on my terraform state when I have bridge perimeters with only enforce(status) config or with only dry-run(spec) config .

Problem:
TF plan:

 # module.vpc-sc[0].google_access_context_manager_service_perimeter.bridge["landing_to_prod"] will be updated in-place
  ~ resource "google_access_context_manager_service_perimeter" "bridge" {
        id                        = "accessPolicies/XXXXXXXX/servicePerimeters/landing_to_prod"
        name                      = "accessPolicies/XXXXXXXX/servicePerimeters/landing_to_prod"
        # (4 unchanged attributes hidden)

      + spec {
          + resources = []
        }

        # (1 unchanged block hidden)
    }

Code:

spec {
resources = each.value.spec_resources == null ? [] : each.value.spec_resources
}
status {
resources = each.value.status_resources == null ? [] : each.value.status_resources

Possible code solution using dynamic blocks(like you have for regular perimeters):

  dynamic spec {
    for_each = each.value.spec_resources == null ? [] : each.value.spec_resources
    content {
      resources = each.value.spec_resources
    }
  }
  dynamic status {
    for_each = each.value.status_resources == null ? [] : each.value.status_resources 
    content {
      resources = each.value.status_resources
    }
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant