Fix persistent diffs in aws_controltower_landing_zone manifest_json #44902
+296
−6
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.
Rollback Plan
In case of any issues, users can rollback to the previous version of the provider. The changes are isolated to the
aws_controltower_landing_zoneresource's diff suppression logic.Changes to Security Controls
No changes to security controls. This PR only affects diff suppression and state normalization for the
manifest_jsonattribute.Description
Fixes #35763
This PR resolves persistent diffs in the
aws_controltower_landing_zoneresource'smanifest_jsonattribute caused by:governedRegionsin a different order than specified in configurationretentionDaysas strings, but users may specify them as numbersThe fix implements a two-part solution:
suppressEquivalentLandingZoneManifestDiffs) that normalizes and compares manifests semanticallyImplementation details:
normalizeManifestJSON()function to:governedRegionsarray alphabetically for order-independent comparisonretentionDaysstring values to numbers inloggingBucketandaccessLoggingBucketconfigurationsReadfunction (state refresh) and diff suppressionTesting:
Unit tests verify the normalization handles:
retentionDaysas number vs string (should suppress diff)governedRegionsin different order (should suppress diff)governedRegionsvalues (should NOT suppress diff)retentionDaysvalues (should NOT suppress diff)Relations
N/A
References
Output from Acceptance Testing
N/A - Unit tests only at this stage. The affected resource requires AWS Organizations management account which is not available in standard acceptance testing.