Skip to content

Conversation

@rafaell94
Copy link

@rafaell94 rafaell94 commented Aug 13, 2025

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:

  1. target = ["v=spf1 include:spf-pp.ia.ca include:spf.protection.outlook.com -all"]
  2. target = ["\"v=spf1 include:spf-pp.ia.ca include:spf.protection.outlook.com -all\""]

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

  1. Prevent trimming for TXT records – The trim operation that removes backslashed quotes is now skipped for TXT record types.
  2. TXT-specific comparison logic – Added a TXT-specific handling block where surrounding quotes are preserved in the comparison value (compval) to ensure formatting differences are detected.

This ensures that legitimate changes to TXT record formatting, particularly for SPF records, are correctly detected and applied.

@lsadlon lsadlon changed the title Fix suppress changes issues when TXT record value/target starts with … DXE-5496 Fix suppress changes issues when TXT record value/target starts with … Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants