Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DXE-3797 Order of targets in akamai_dns_record can cause problems. #541

Closed
tmccombs opened this issue Apr 18, 2024 · 3 comments
Closed

DXE-3797 Order of targets in akamai_dns_record can cause problems. #541

tmccombs opened this issue Apr 18, 2024 · 3 comments

Comments

@tmccombs
Copy link

Terraform Version

Terraform v1.7.2
on linux_amd64
+ provider registry.terraform.io/akamai/akamai v5.5.0
+ provider registry.terraform.io/hashicorp/tfe v0.53.0
+ provider registry.terraform.io/scottwinkler/shell v1.7.10

Your version of Terraform is out of date! The latest version
is 1.8.1. You can update by downloading from https://www.terraform.io/downloads.html

Affected Resource(s)

  • akamai_dns_record

Terraform Configuration Files

resource "akamai_dns_record" "example" {
  zone = var.akamai_zone
  name = "test.example.com"
  recordtype = "txt"
  ttl = 60
  target = [
    "zzz",
   "aaa",
   "123",
  ]
}

Expected Behavior

If I change the "zzz" record to something else, like sy "yyz", then it will update that one record.

Actual Behavior

First of all, the diff shows up really strange, something like:

~ target = [
    "123",
    "aaa"
  - "zzz",
 + "123",
 ]

Which is really weird.

And secondly, if you assume this is just a bug in the diff engine and try to apply the change, you get an error like:

Error: Title: Invalid record; Type: https://problems.luna.akamaiapis.net/authoritative-dns/invalidRecord; Detail: Duplicate rdata found for record with name test.example.com and type TXT

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:
1.terraform apply the original config
2. change the "zzz" target to "yyz"
3. run terraform plan
4. try to apply the plan

@PawelSnoch PawelSnoch changed the title Order of targets in akamai_dns_record can cause problems. [DXE-3797] Order of targets in akamai_dns_record can cause problems. Apr 19, 2024
@PawelSnoch PawelSnoch changed the title [DXE-3797] Order of targets in akamai_dns_record can cause problems. DXE-3797 Order of targets in akamai_dns_record can cause problems. Apr 19, 2024
@PawelSnoch
Copy link

Hello @tmccombs ,

Thank you for reporting this ticket.
I was able to reproduce similar case. Could you please add your "target" value from terraform.tfstate after first apply?

Thanks,
Pawel

@tmccombs
Copy link
Author

In my real application, the value of target in tfstate after first apply was:

[
              "\"3z1fjzgxsdy86ky8szvm6gwtxndz6mm0\"",
              "\"google-site-verification=pUccO5tWSRUD5eVkunk5MFAA3B-G-_c5Yh75tSLdjYE\"",
              "\"v=spf1 include:usb._netblocks.mimecast.com include:mktomail.com include:email.influitive.com ~all\""
 ]

The config was in the order:

[                                                                                                               
  "v=spf1 include:mktomail.com include:email.influitive.com ~all",                                              
  "google-site-verification=pUccO5tWSRUD5eVkunk5MFAA3B-G-_c5Yh75tSLdjYE",                  
  "3z1fjzgxsdy86ky8szvm6gwtxndz6mm0",                                     
]       

and the plan showed:
image

If I changed the order of config to match what was in state, then it worked fine.

Interestingly, this behavior seems to be specific to TXT records. For MX records, akamai preserves the order of the inputs.

@mgwoj
Copy link
Contributor

mgwoj commented Jul 19, 2024

Hi @tmccombs, this issue should be fixed in the recent release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

5 participants