Error: Record does not exist. (81044) with cloudflare_record.site_cname, on main.tf line 90, in resource "cloudflare_record" "site_cname"

I am doing this tutorial
https://developers.cloudflare.com/cloudflare-one/api-terraform/access-with-terraform/

This is my repo

When I run this:


tf apply -auto-approve

Output:

data.cloudflare_zones.domain: Reading...
data.cloudflare_zones.domain: Read complete after 1s [id=010561c6841c1d1ab17e671680567a3f]
aws_s3_bucket.www: Refreshing state... [id=www.mydomain.com]
aws_s3_bucket.site: Refreshing state... [id=mydomain.com]
aws_s3_bucket_acl.www: Refreshing state... [id=www.mydomain.com,private]
cloudflare_record.site_cname: Refreshing state... [id=28bf5e5065954870ddca105fb5fc0eb2]
aws_s3_bucket_website_configuration.site: Refreshing state... [id=mydomain.com]
aws_s3_bucket_website_configuration.www: Refreshing state... [id=mydomain.com]
aws_s3_bucket_policy.site: Refreshing state... [id=mydomain.com]
aws_s3_bucket_acl.site: Refreshing state... [id=mydomain.com,public-read]

Error: Record does not exist. (81044)

with cloudflare_record.site_cname,
on main.tf line 90, in resource "cloudflare_record" "site_cname":
90: resource "cloudflare_record" "site_cname" {

I am not sure what record does not exist.

This is what my DNS console looks like:

Note that I don’t have anything there, I want Terraform to maintain it, not me in the console

Any help is appreciated
Thanks

Terraform seems to think you have an existing DNS record. I would clear your state file. Try terraform state rm 'cloudflare_record.site_cname'.

2 Likes

That worked, Thanks!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.