google_alloydb_instance: fix permadiff on network_config.enable_public_ip#18245
Open
BBBmau wants to merge 3 commits into
Open
google_alloydb_instance: fix permadiff on network_config.enable_public_ip#18245BBBmau wants to merge 3 commits into
google_alloydb_instance: fix permadiff on network_config.enable_public_ip#18245BBBmau wants to merge 3 commits into
Conversation
Trim the empty-block fallback to reconstruct only the two boolean fields, drop redundant send_empty_value/default_from_api on the booleans, and define the required child flatteners in the template (previously undefined, which broke compilation).
Combine the separate nil and empty-map checks into a single comma-ok type assertion.
Collaborator
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 0e0db27: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 11 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the replaying VCR build log Step 2: Recording Mode
🟢 All tests passed! View the recording VCR build log or the debug logs folder for detailed results. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes a permadiff issue where
google_alloydb_instancecontinuously shows a diff addingnetwork_config { enable_public_ip = false }even after it has been applied.Upstream issue: hashicorp/terraform-provider-google#22197
Root Cause
The AlloyDB API omits
networkConfigentirely from GET responses when bothenable_public_ipandenable_outbound_public_iparefalse(the default). This created a perpetual diff cycle:network_config { enable_public_ip = false }and appliesfalseis treated as an empty value byIsEmptyValueand is not sent to the APInilfornetworkConfigin subsequent readsnil→ state is cleared (network_config = [])plan: config has the block, state is empty → diff shown foreverThis is the same pattern that was previously fixed for
connection_pool_config.Fix
mmv1/products/alloydb/Instance.yaml:custom_flattenpointing to a new template fornetworkConfigsend_empty_value: truetoenablePublicIpandenableOutboundPublicIpso thatfalseis sent explicitly to the API (changes expand logic from!IsEmptyValuecheck to!= nil)default_from_api: trueto those same fields so they are treated as computed in statemmv1/templates/terraform/custom_flatten/alloydb_instance_networkconfig_flatten.go.tmpl(new):nilor emptynetworkConfig, preserves the existing state values instead of clearing the block — eliminates the permadiffTesting
Manually reproduced the scenario described in the issue:
network_config { enable_public_ip = false }terraform planshows the block being addedRelated
connectionPoolConfig:mmv1/templates/terraform/custom_flatten/alloydb_instance_connectionpoolconfig_flatten.go.tmplRelease Notes