akamai / terraform-provider-akamai

Terraform Akamai provider
https://www.terraform.io/docs/providers/akamai/
Mozilla Public License 2.0
109 stars 96 forks source link

DXE-4295 EdgeDNS TXT records with semicolons are interpreted in different way then terraform shows in the plan. #586

Open martin-simek-gen opened 1 week ago

martin-simek-gen commented 1 week ago

Hi there,

We have hit a bit problematic behaving of akamai provider for TXT DNS records containing semicolon. If the manifest contains semicolon ; the terraform plan show that target of TXT record will be written with semicolon, but akamai provider or API will cut off semicolon and all behind it.

Terraform and Akamai Terraform Provider Versions

Akamai provider: the latest release (6.4.0) and all previous one Terraform: v1.9.7 + v1.7.5 Terragrunt version v0.67.14

Affected Resource(s)

Terraform Configuration Files

resource "akamai_dns_record" "txt" {
  name       = "testingi2.workplace.avast.com"
  recordtype = "TXT"
  ttl        = 300
  target     = [
    "k=DKIM; test",
    "k=DKIM2; test2; test",
    "\"k=DKIM3; test3\"","foo"
  ]
}

Debug Output

this shows terraform plan:

# akamai_dns_record.txt["txt3.testingi2.workplace.avast.com"] will be created
+ resource "akamai_dns_record" "txt" {
    + answer_type = (known after apply)
    + dns_name    = (known after apply)
    + id          = (known after apply)
    + name        = "txt3.testingi2.workplace.avast.com"
    + record_sha  = (known after apply)
    + recordtype  = "TXT"
    + serial      = (known after apply)
    + target      = [
        + "k=DKIM; test",
        + "k=DKIM2; test2; test",
        + "\"k=DKIM3; test3\"",
      ]
    + ttl         = 300
    + zone        = "testingi2.workplace.avast.com"
  }

DNS answer:

dig @akamai.com txt3.testingi2.workplace.avast.com TXT +short
"k=DKIM"
"k=DKIM3; test3"
"k=DKIM2"

Expected Behavior

Actual Behavior

The result of added TXT record is without semicolon

KonradRajda commented 6 days ago

Hi @martin-simek-gen

I was able to reproduce this issue and create internal ticket to fix it. We will inform you about progress.

Best regards, Konrad

lkowalsk-akamai-com commented 22 hours ago

Hi @martin-simek-gen, truncation of entries after semicolon is done on the API level. In order to have them preserved you need to wrap the entry in additional quotes, like it was done here: "\"k=DKIM3; test3\"". Please add those escaped quotes if you want to use semicolons.