diff --git a/docs/_providers/cloudflare.md b/docs/_providers/cloudflare.md index 3e64897ac..a1ad7dbc0 100644 --- a/docs/_providers/cloudflare.md +++ b/docs/_providers/cloudflare.md @@ -6,6 +6,10 @@ jsId: CLOUDFLAREAPI --- # Cloudflare Provider +## Important notes + +* When using `SPF()` or the `SPF_BUILDER()` the records are converted to RecordType `TXT` as Cloudflare API fails otherwise. See more [here](https://github.com/StackExchange/dnscontrol/issues/446). + ## Configuration In the credentials file you must provide your Cloudflare API username and access token: diff --git a/providers/cloudflare/cloudflareProvider.go b/providers/cloudflare/cloudflareProvider.go index 2b70c39fb..9984516ed 100644 --- a/providers/cloudflare/cloudflareProvider.go +++ b/providers/cloudflare/cloudflareProvider.go @@ -393,6 +393,12 @@ func (c *cfRecord) nativeToRecord(domain string) *models.RecordConfig { Original: c, } rc.SetLabelFromFQDN(c.Name, domain) + + // workaround for https://github.com/StackExchange/dnscontrol/issues/446 + if c.Type == "SPF" { + c.Type = "TXT" + } + switch rType := c.Type; rType { // #rtype_variations case "MX": var priority uint16