Closed remibergsma closed 2 months ago
Hi @remibergsma
Thank you for reporting this. It's under investigation. We will get back to you soon.
Regard, Marcin
Hi @remibergsma, this issue should be fixed in the recent release.
Awesome, thanks @mgwoj !
Terraform and Akamai Terraform Provider Versions
1.8.5
Affected Resource(s)
Please list the resources as a list, for example:
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
Terraform Configuration Files
Happens in all cases, due to sort method on this line: https://github.com/akamai/terraform-provider-akamai/blob/86da2eeee4d9b78e57aaa78b5135b1d216bd1309/pkg/providers/dns/data_dns_record_set.go#L84
Debug Output
None
Panic Output
None
Expected Behavior
TXT records should be created in the order as specified and not sorted.
Actual Behavior
TXT records are sorted (due to https://github.com/akamai/terraform-provider-akamai/blob/86da2eeee4d9b78e57aaa78b5135b1d216bd1309/pkg/providers/dns/data_dns_record_set.go#L84)
Steps to Reproduce
Create TXT record with multiple targets. We use this to specify DKIM public keys. Since only 1024 bit keys fit on a single entry, when using 2048bit keys one needs to put them over multiple targets. Starting with the "v=DKIM1" line, and then the exact order as specified.
Example code:
provider "akamai" { edgerc = "~/.edgerc" # path to your .edgerc file with credentials edgerc_section = "default" # section in .edgerc file to use }
resource "akamai_dns_zone" "example_zone" { zone = "example.com" }
resource "akamai_dns_record" "dkim_txt_record" { zone = akamai_dns_zone.example_zone.zone name = "selector1._domainkey.example.com" type = "TXT" ttl = 300
The DKIM public key split into 255 character chunks, wrapped in quotes and separated by a space
target = "\"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2dF6Q...\" " "\"ZZZZ...b6r0jqmVz0f34kz3QnupRJqdlh...\" " "\"AAAA...iDfOckf1TIwIDAQAB\"" }
output "dns_record_id" { value = akamai_dns_record.dkim_txt_record.id }
Note that the record gets created, but that part AAA of the key (which is supposed to be at the end) is now sorted. This is obviously breaking the public key.
Important Factoids
None
References