cloudflare / terraform-provider-cloudflare

Cloudflare Terraform Provider
https://registry.terraform.io/providers/cloudflare/cloudflare
Mozilla Public License 2.0
789 stars 609 forks source link

Removing a DNS record outside terraform breaks #4581

Closed david-haugh closed 5 hours ago

david-haugh commented 5 hours ago

Confirmation

Terraform and Cloudflare provider version

Terraform v1.9.5 provider "5.0.0-alpha1"

Affected resource(s)

cloudflare_dns_record

Terraform configuration files

terraform {
  required_providers {
    cloudflare = {
      source  = "cloudflare/cloudflare"
      version = "5.0.0-alpha1"
    }
  }
}

provider "cloudflare" {
  api_token = "TOKEN"
}

resource "cloudflare_dns_record" "all_records" {
  name     = "temp"
  zone_id  = "ZONE"
  content  = "www.google.com"
  ttl      = 60
  type     = "CNAME"
}

Link to debug output

https://aoeuaoeuaoeuaoeuu.blob.core.windows.net/temp/log.txt

Panic output

No response

Expected output

The provider should detect the resource is missing and add it. It should not crash.

Actual output

│ Error: failed to make http request │ │ with cloudflare_dns_record.all_records["frontend"], │ on dns.tf line 52, in resource "cloudflare_dns_record" "all_records": │ 52: resource "cloudflare_dns_record" "all_records" { │ │ GET │ "https://api.cloudflare.com/client/v4/zones/be632ff0a3fc2321688003bbcd0e227f/dns_records/480f7f51fd04e5249631f35a1ed2439d": │ 404 Not Found {"result":null,"success":false,"errors":[{"code":81044,"message":"Record does not
│ exist."}],"messages":[]}

Steps to reproduce

  1. Create a DNS record through terraform
  2. Delete one DNS record through the cloudflare portal

Additional factoids

The problem is that I have to modify my .tfstate file manually to resolve this.

References

No response

github-actions[bot] commented 5 hours ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

jacobbednarz commented 5 hours ago

this is a known issue with the 5.0.0-alpha1 and we're not yet tracking public bugs. it will be fixed in later releases.