Skip to content

Conversation

KelvinVenancio
Copy link
Contributor

Problem

PR #718 was a temporary workaround for a provider bug, but now causes permanent drift:

# Every terraform plan shows this, even when PSC is disabled:
+ psc_config {
    + allowed_consumer_projects = []
    + psc_enabled               = false
  }

Root cause: Workaround forces psc_config creation via ["psc_disabled"], but GCP API omits the block when PSC is disabled → constant state mismatch.

Solution

The original provider issue is fixed, reverting to the original behavior:

- for_each = ip_configuration.value.psc_enabled ? ["psc_enabled"] : ["psc_disabled"]
+ for_each = lookup(ip_configuration.value, "psc_enabled", false) ? [1] : []

Testing Results

psc_enabled = false → No drift, no unnecessary blocks
psc_enabled = true → Proper block creation
✅ No PSC config → No drift, clean plans

Before: terraform plan always shows psc_config changes
After: terraform plan shows "No changes" when appropriate

Reverts: #718 | Resolves: #750

What do you guys think?

Thanks.

@imrannayer
Copy link
Collaborator

/gcbrun

@imrannayer imrannayer merged commit 3cb3eee into terraform-google-modules:main Aug 4, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

This change seemed to _cause_ a permadiff for those fields, for my configuration at least.
2 participants