Skip to content

Content field validation missing for TXT cloudflare_dns_record #6354

@lkanerv

Description

@lkanerv

Confirmation

  • This is a bug with an existing resource and is not a feature request or enhancement. Feature requests should be submitted with Cloudflare Support or your account team.
  • I have searched the issue tracker and my issue isn't already found.
  • I have replicated my issue using the latest version of the provider and it is still present.

Terraform and Cloudflare provider version

tofu version 1.10.6
cloudflare provider version 5.10

Affected resource(s)

cloudflare_dns_record

Terraform configuration files

resource "cloudflare_dns_record" "example_txt_dns_record" {
  zone_id = "example"
  name = "example"
  ttl = 3600
  type = "TXT"
  content = "some-string"
  proxied = false

}

Link to debug output

n/a, apply is successful and error is displayed only on cloudflare UI (see attached screenshot)

Panic output

No response

Expected output

Since TXT content strings are expected to have wrapping quotes, then the cloudflare_dns_record should return a validation error at either plan time (ideally). Or return a 400 code error in the API response.

Actual output

The resource is created successfully, but then viewing the live TXT record on the cloudflare portal UI shows the following warning:

The content field of TXT records must be in quotation marks. Cloudflare may add quotation marks on your behalf, which will not affect how the record works

Image

Steps to reproduce

Use cloudflare_dns_record resource of type "TXT" with a content field that lacks escaped wrapper quotation marks.

Additional factoids

The docs don't mention the wrapping quotation mark requirement for TXT dns records: https://github.com/cloudflare/terraform-provider-cloudflare/blob/e694bcf15baa2249c8ea3ece35a5b3254fa49ea4/docs/resources/dns_record.md

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions