Skip to main content

zones_dns_records

Creates, updates, deletes, gets or lists a zones_dns_records resource.

Overview

Namezones_dns_records
TypeResource
Idcloudflare.dns.zones_dns_records

Fields

The following fields are returned by SELECT queries:

List DNS Records response

NameDatatypeDescription
idstringIdentifier. (example: 023e105f4ecef8ad9ca31a8372d0c353)
namestringComplete DNS record name, including the zone name, in Punycode. (example: example.com)
commentstringComments or notes about the DNS record. This field has no effect on DNS responses. (example: Domain verification record)
comment_modified_onstring (date-time)When the record comment was last modified. Omitted if there is no comment. (example: 2024-01-01T05:20:00.12345Z, x-stainless-terraform-configurability: computed)
contentstring (ipv4)A valid IPv4 address. (example: 198.51.100.4)
created_onstring (date-time)When the record was created. (example: 2014-01-01T05:20:00.12345Z, x-stainless-terraform-configurability: computed)
dataobjectComponents of a CAA record.
metaobjectExtra Cloudflare-specific information about the record. (x-stainless-terraform-configurability: computed)
modified_onstring (date-time)When the record was last modified. (example: 2014-01-01T05:20:00.12345Z, x-stainless-terraform-configurability: computed)
prioritynumberRequired for MX and URI records; ignored for other record types (but may still be returned by the API). Records with lower priorities are preferred. This field is to be deprecated in favor of the priority field within the data map.
private_routingbooleanEnables private network routing to the origin.
proxiablebooleanWhether the record can be proxied by Cloudflare or not. (x-stainless-terraform-configurability: computed)
proxiedbooleanWhether the record is receiving the performance and security benefits of Cloudflare.
settingsobjectSettings for the DNS record.
tagsarrayCustom tags for the DNS record. This field has no effect on DNS responses. (x-stainless-collection-type: set)
tags_modified_onstring (date-time)When the record tags were last modified. Omitted if there are no tags. (example: 2025-01-01T05:20:00.12345Z, x-stainless-terraform-configurability: computed)
ttlnumberTime To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. Value must be between 60 and 86400, with the minimum reduced to 30 for Enterprise zones. (1)
typestringRecord type. (A) (example: A)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectzone_idname, name.exact, name.contains, name.startswith, name.endswith, type, content, content.exact, content.contains, content.startswith, content.endswith, proxied, match, comment, comment.present, comment.absent, comment.exact, comment.contains, comment.startswith, comment.endswith, tag, tag.present, tag.absent, tag.exact, tag.contains, tag.startswith, tag.endswith, search, tag_match, page, per_page, order, directionList, search, sort, and filter a zones' DNS records.
createinsertzone_id, name, ttl, typeCreate a new DNS record for a zone. Notes: - A/AAAA records cannot exist on the same name as CNAME records. - NS records cannot exist on the same name as any other record type. - Domain names are always represented in Punycode, even if Unicode characters were used when creating the record.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
zone_idstringThe Cloudflare zone ID.
commentstring
comment.absentstring
comment.containsstring
comment.endswithstring
comment.exactstring
comment.presentstring
comment.startswithstring
contentstring
content.containsstring
content.endswithstring
content.exactstring
content.startswithstring
directionstring
matchstring
namestring
name.containsstring
name.endswithstring
name.exactstring
name.startswithstring
orderstring
pagenumber
per_pagenumber
proxiedboolean
tagstring
tag.absentstring
tag.containsstring
tag.endswithstring
tag.exactstring
tag.presentstring
tag.startswithstring
tag_matchstring
typestring

SELECT examples

List, search, sort, and filter a zones' DNS records.

SELECT
id,
name,
comment,
comment_modified_on,
content,
created_on,
data,
meta,
modified_on,
priority,
private_routing,
proxiable,
proxied,
settings,
tags,
tags_modified_on,
ttl,
type
FROM cloudflare.dns.zones_dns_records
WHERE zone_id = '{{ zone_id }}' -- required
AND name = '{{ name }}'
AND name.exact = '{{ name.exact }}'
AND name.contains = '{{ name.contains }}'
AND name.startswith = '{{ name.startswith }}'
AND name.endswith = '{{ name.endswith }}'
AND type = '{{ type }}'
AND content = '{{ content }}'
AND content.exact = '{{ content.exact }}'
AND content.contains = '{{ content.contains }}'
AND content.startswith = '{{ content.startswith }}'
AND content.endswith = '{{ content.endswith }}'
AND proxied = '{{ proxied }}'
AND match = '{{ match }}'
AND comment = '{{ comment }}'
AND comment.present = '{{ comment.present }}'
AND comment.absent = '{{ comment.absent }}'
AND comment.exact = '{{ comment.exact }}'
AND comment.contains = '{{ comment.contains }}'
AND comment.startswith = '{{ comment.startswith }}'
AND comment.endswith = '{{ comment.endswith }}'
AND tag = '{{ tag }}'
AND tag.present = '{{ tag.present }}'
AND tag.absent = '{{ tag.absent }}'
AND tag.exact = '{{ tag.exact }}'
AND tag.contains = '{{ tag.contains }}'
AND tag.startswith = '{{ tag.startswith }}'
AND tag.endswith = '{{ tag.endswith }}'
AND search = '{{ search }}'
AND tag_match = '{{ tag_match }}'
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
AND order = '{{ order }}'
AND direction = '{{ direction }}'
;

INSERT examples

Create a new DNS record for a zone. Notes: - A/AAAA records cannot exist on the same name as CNAME records. - NS records cannot exist on the same name as any other record type. - Domain names are always represented in Punycode, even if Unicode characters were used when creating the record.

INSERT INTO cloudflare.dns.zones_dns_records (
comment,
name,
proxied,
settings,
tags,
ttl,
content,
private_routing,
type,
priority,
data,
zone_id
)
SELECT
'{{ comment }}',
'{{ name }}' /* required */,
{{ proxied }},
'{{ settings }}',
'{{ tags }}',
{{ ttl }} /* required */,
'{{ content }}',
{{ private_routing }},
'{{ type }}' /* required */,
{{ priority }},
'{{ data }}',
'{{ zone_id }}'
RETURNING
errors,
messages,
result,
success
;