DXE-5496 Fix suppress changes issues when TXT record value/target starts with … #684
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.
Summary
The diffQuotedDNSRecord helper, used by the dnsRecordTargetSuppress function, currently trims backslashed quotes from both old and new values before comparison. While this works for most record types, it causes incorrect behavior for TXT records, where the presence of backslashed quotes changes the meaning of the value.
Problem
For example, consider these two target values:
If one value is in the Terraform state and you update it to the other, the current logic incorrectly reports:
No changes. Your infrastructure matches the configuration.However:
The first value results in an improperly formatted SPF record.
The second value is a properly formatted SPF record.
Changes Made
This ensures that legitimate changes to TXT record formatting, particularly for SPF records, are correctly detected and applied.