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-4293 EdgeDNS terraform fails with "Record not found" if real DNS record is deleted out of terraform #584

Open martin-simek-gen opened 1 week ago

martin-simek-gen commented 1 week ago

Hi there,

We currently get errors from the provider when DNS record is deleted out of terraform. We use terraform as IaC to manage our large number of DNS records. But there are situations that someone destroys DNS record via Akamai API or WEB UI. In this case our terraform pipeline will fail with "Error: Record not found" which is quite annoying. We are expecting terraform to fix our DNS infra according to our terraform manifests. There are 2 ways how to fix it, but it needs hands to do it, like remove record from terraform state file or create the DNS record via UI and then run terraform again.

We use terraform with other providers like google, aws, nsone .... and we experience different behaving, like if the resource is missing on cloud service, the terraform will fix it and create the resource again. I would expect exact the same behavior from Akamai provider.

I see the issue #577 --> https://github.com/akamai/terraform-provider-akamai/issues/577 which is very similar to our issue, but for GTM. I think this is global issue for akamai provider how it handle resources.

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" "a" {
  for_each   = var.dns_a == null ? {} : { for fqdn, data in var.dns_a : fqdn => data }
  zone       = var.zone
  name       = "${each.key}"
  recordtype = "A"
  ttl        = each.value.ttl != null ? each.value.ttl : local.default_ttl
  target     = each.value.target
}

Expected Behavior

In case that record is destroyed out of terraform, the terraform plan/apply should create the record instead of failing.

Actual Behavior

Terraform plan/apply will fail with message: Error: Record not found

Steps to Reproduce

  1. Create a DNS record via terraform
  2. Destroy the DNS record via Web UI
  3. Run terraform again ... it will fail on creating plan

References

lsadlon commented 5 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.

BR, Lukasz