zones_dns_records
Creates, updates, deletes, gets or lists a zones_dns_records resource.
Overview
| Name | zones_dns_records |
| Type | Resource |
| Id | cloudflare.dns.zones_dns_records |
Fields
The following fields are returned by SELECT queries:
- list
List DNS Records response
| Name | Datatype | Description |
|---|---|---|
id | string | Identifier. (example: 023e105f4ecef8ad9ca31a8372d0c353) |
name | string | Complete DNS record name, including the zone name, in Punycode. (example: example.com) |
comment | string | Comments or notes about the DNS record. This field has no effect on DNS responses. (example: Domain verification record) |
comment_modified_on | string (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) |
content | string (ipv4) | A valid IPv4 address. (example: 198.51.100.4) |
created_on | string (date-time) | When the record was created. (example: 2014-01-01T05:20:00.12345Z, x-stainless-terraform-configurability: computed) |
data | object | Components of a CAA record. |
meta | object | Extra Cloudflare-specific information about the record. (x-stainless-terraform-configurability: computed) |
modified_on | string (date-time) | When the record was last modified. (example: 2014-01-01T05:20:00.12345Z, x-stainless-terraform-configurability: computed) |
priority | number | Required 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_routing | boolean | Enables private network routing to the origin. |
proxiable | boolean | Whether the record can be proxied by Cloudflare or not. (x-stainless-terraform-configurability: computed) |
proxied | boolean | Whether the record is receiving the performance and security benefits of Cloudflare. |
settings | object | Settings for the DNS record. |
tags | array | Custom tags for the DNS record. This field has no effect on DNS responses. (x-stainless-collection-type: set) |
tags_modified_on | string (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) |
ttl | number | Time 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) |
type | string | Record type. (A) (example: A) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | zone_id | name, 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, direction | List, search, sort, and filter a zones' DNS records. |
create | insert | zone_id, name, ttl, type | 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. |
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.
| Name | Datatype | Description |
|---|---|---|
zone_id | string | The Cloudflare zone ID. |
comment | string | |
comment.absent | string | |
comment.contains | string | |
comment.endswith | string | |
comment.exact | string | |
comment.present | string | |
comment.startswith | string | |
content | string | |
content.contains | string | |
content.endswith | string | |
content.exact | string | |
content.startswith | string | |
direction | string | |
match | string | |
name | string | |
name.contains | string | |
name.endswith | string | |
name.exact | string | |
name.startswith | string | |
order | string | |
page | number | |
per_page | number | |
proxied | boolean | |
search | string | |
tag | string | |
tag.absent | string | |
tag.contains | string | |
tag.endswith | string | |
tag.exact | string | |
tag.present | string | |
tag.startswith | string | |
tag_match | string | |
type | string |
SELECT examples
- list
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
- Manifest
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
;
# Description fields are for documentation purposes
- name: zones_dns_records
props:
- name: zone_id
value: "{{ zone_id }}"
description: Required parameter for the zones_dns_records resource.
- name: comment
value: "{{ comment }}"
description: |
Comments or notes about the DNS record. This field has no effect on DNS responses.
- name: name
value: "{{ name }}"
description: |
Complete DNS record name, including the zone name, in Punycode.
- name: proxied
value: {{ proxied }}
description: |
Whether the record is receiving the performance and security benefits of Cloudflare.
default: false
- name: settings
description: |
Settings for the DNS record.
value:
ipv4_only: {{ ipv4_only }}
ipv6_only: {{ ipv6_only }}
- name: tags
value:
- "{{ tags }}"
description: |
Custom tags for the DNS record. This field has no effect on DNS responses.
default:
- name: ttl
value: {{ ttl }}
description: |
Time 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.
valid_values: ['1']
default: 1
- name: content
value: "{{ content }}"
description: |
A valid IPv4 address.
- name: private_routing
value: {{ private_routing }}
description: |
Enables private network routing to the origin.
default: false
- name: type
value: "{{ type }}"
description: |
Record type.
valid_values: ['A']
- name: priority
value: {{ priority }}
description: |
Required 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.
- name: data
description: |
Components of a CAA record.
value:
flags: {{ flags }}
tag: "{{ tag }}"
value: "{{ value }}"