Fix permadiff that reorders stateful_external_ip
blocks on google_compute_instance_group_manager
and google_compute_region_instance_group_manager
resources
#1833
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.
Relates to (but doesn't close!) this issue : hashicorp/terraform-provider-google#13430
This PR updates code related to
stateful_external_ip
blocks in thegoogle_compute_instance_group_manager
&google_compute_region_instance_group_manager
resources to address a permadiff that proposes re-ordering those blocks. The root of this problem is that the API returns those blocks in a sorted order that doesn't match the user's config. The state will contain data returned from the API, so there's always a plan trying to return to the config-defined order.Prior to this PR, the flattener function for
stateful_external_ip
blocks performs a conversion from a map (how the data from the API is presented by the compute Go client library) to an array (how the data is stored in state).This PR updates the flattener function to also re-order data returned by the API so it matches the user's Terraform configuration. This is achieved by passing the
schema.ResourceData
data for the resource into the flattener, to act as a source of information about the order of those fields in the user's config.Release Note Template for Downstream PRs (will be copied)
Derived from GoogleCloudPlatform/magic-modules#9577