Skip to content
Start here

Records

resource cloudflare_dns_record

required Expand Collapse
zone_id: String

Identifier.

name: String

Complete DNS record name, including the zone name, in Punycode.

type: String

Record type.

optional Expand Collapse
comment?: String

Comments or notes about the DNS record. This field has no effect on DNS responses.

content?: String

A valid IPv4 address.

priority?: Float64

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.

data?: Attributes

Components of a CAA record.

flags?: Dynamic Float64 | String

Flags for the CAA record.

tag?: String

Name of the property controlled by this record (e.g.: issue, issuewild, iodef).

value?: String

Value of the record. This field's semantics depend on the chosen tag.

algorithm?: Float64

Algorithm.

certificate?: String

Certificate.

key_tag?: Float64

Key Tag.

type?: Float64

Type.

protocol?: Float64

Protocol.

public_key?: String

Public Key.

digest?: String

Digest.

digest_type?: Float64

Digest Type.

priority?: Float64

Priority.

target?: String

Target.

altitude?: Float64

Altitude of location in meters.

lat_degrees?: Float64

Degrees of latitude.

lat_direction?: String

Latitude direction.

lat_minutes?: Float64

Minutes of latitude.

lat_seconds?: Float64

Seconds of latitude.

long_degrees?: Float64

Degrees of longitude.

long_direction?: String

Longitude direction.

long_minutes?: Float64

Minutes of longitude.

long_seconds?: Float64

Seconds of longitude.

precision_horz?: Float64

Horizontal precision of location.

precision_vert?: Float64

Vertical precision of location.

size?: Float64

Size of location in meters.

order?: Float64

Order.

preference?: Float64

Preference.

regex?: String

Regex.

replacement?: String

Replacement.

service?: String

Service.

matching_type?: Float64

Matching Type.

selector?: Float64

Selector.

usage?: Float64

Usage.

port?: Float64

The port of the service.

weight?: Float64

The record weight.

fingerprint?: String

Fingerprint.

private_routing?: Bool

Enables private network routing to the origin.

proxied?: Bool

Whether the record is receiving the performance and security benefits of Cloudflare.

ttl?: Float64

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.

tags?: Set[String]

Custom tags for the DNS record. This field has no effect on DNS responses.

settings?: Attributes

Settings for the DNS record.

ipv4_only?: Bool

When enabled, only A records will be generated, and AAAA records will not be created. This setting is intended for exceptional cases. Note that this option only applies to proxied records and it has no effect on whether Cloudflare communicates with the origin using IPv4 or IPv6.

ipv6_only?: Bool

When enabled, only AAAA records will be generated, and A records will not be created. This setting is intended for exceptional cases. Note that this option only applies to proxied records and it has no effect on whether Cloudflare communicates with the origin using IPv4 or IPv6.

flatten_cname?: Bool

If enabled, causes the CNAME record to be resolved externally and the resulting address records (e.g., A and AAAA) to be returned instead of the CNAME record itself. This setting is unavailable for proxied records, since they are always flattened.

computed Expand Collapse
id: String

Identifier.

comment_modified_on: Time

When the record comment was last modified. Omitted if there is no comment.

created_on: Time

When the record was created.

modified_on: Time

When the record was last modified.

proxiable: Bool

Whether the record can be proxied by Cloudflare or not.

tags_modified_on: Time

When the record tags were last modified. Omitted if there are no tags.

meta: JSON

Extra Cloudflare-specific information about the record.

cloudflare_dns_record

resource "cloudflare_dns_record" "example_dns_record" {
  zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
  name = "example.com"
  ttl = 3600
  type = "A"
  comment = "Domain verification record"
  content = "198.51.100.4"
  private_routing = true
  proxied = true
  settings = {
    ipv4_only = true
    ipv6_only = true
  }
  tags = ["owner:dns-team"]
}

data cloudflare_dns_record

required Expand Collapse
zone_id: String

Identifier.

optional Expand Collapse
dns_record_id?: String

Identifier.

filter?: Attributes
comment?: Attributes
absent?: String

If this parameter is present, only records without a comment are returned.

contains?: String

Substring of the DNS record comment. Comment filters are case-insensitive.

endswith?: String

Suffix of the DNS record comment. Comment filters are case-insensitive.

exact?: String

Exact value of the DNS record comment. Comment filters are case-insensitive.

present?: String

If this parameter is present, only records with a comment are returned.

startswith?: String

Prefix of the DNS record comment. Comment filters are case-insensitive.

content?: Attributes
contains?: String

Substring of the DNS record content. Content filters are case-insensitive.

endswith?: String

Suffix of the DNS record content. Content filters are case-insensitive.

exact?: String

Exact value of the DNS record content. Content filters are case-insensitive.

startswith?: String

Prefix of the DNS record content. Content filters are case-insensitive.

direction?: String

Direction to order DNS records in.

match?: String

Whether to match all search requirements or at least one (any). If set to all, acts like a logical AND between filters. If set to any, acts like a logical OR instead. Note that the interaction between tag filters is controlled by the tag-match parameter instead.

name?: Attributes
contains?: String

Substring of the DNS record name. Name filters are case-insensitive.

endswith?: String

Suffix of the DNS record name. Name filters are case-insensitive.

exact?: String

Exact value of the DNS record name. Name filters are case-insensitive.

startswith?: String

Prefix of the DNS record name. Name filters are case-insensitive.

order?: String

Field to order DNS records by.

proxied?: Bool

Whether the record is receiving the performance and security benefits of Cloudflare.

tag?: Attributes
absent?: String

Name of a tag which must not be present on the DNS record. Tag filters are case-insensitive.

contains?: String

A tag and value, of the form <tag-name>:<tag-value>. The API will only return DNS records that have a tag named <tag-name> whose value contains <tag-value>. Tag filters are case-insensitive.

endswith?: String

A tag and value, of the form <tag-name>:<tag-value>. The API will only return DNS records that have a tag named <tag-name> whose value ends with <tag-value>. Tag filters are case-insensitive.

exact?: String

A tag and value, of the form <tag-name>:<tag-value>. The API will only return DNS records that have a tag named <tag-name> whose value is <tag-value>. Tag filters are case-insensitive.

present?: String

Name of a tag which must be present on the DNS record. Tag filters are case-insensitive.

startswith?: String

A tag and value, of the form <tag-name>:<tag-value>. The API will only return DNS records that have a tag named <tag-name> whose value starts with <tag-value>. Tag filters are case-insensitive.

tag_match?: String

Whether to match all tag search requirements or at least one (any). If set to all, acts like a logical AND between tag filters. If set to any, acts like a logical OR instead. Note that the regular match parameter is still used to combine the resulting condition with other filters that aren't related to tags.

type?: String

Record type.

computed Expand Collapse
id: String

Identifier.

comment: String

Comments or notes about the DNS record. This field has no effect on DNS responses.

comment_modified_on: Time

When the record comment was last modified. Omitted if there is no comment.

content: String

A valid IPv4 address.

created_on: Time

When the record was created.

modified_on: Time

When the record was last modified.

name: String

Complete DNS record name, including the zone name, in Punycode.

priority: Float64

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: Bool

Enables private network routing to the origin.

proxiable: Bool

Whether the record can be proxied by Cloudflare or not.

proxied: Bool

Whether the record is receiving the performance and security benefits of Cloudflare.

tags_modified_on: Time

When the record tags were last modified. Omitted if there are no tags.

ttl: Float64

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.

type: String

Record type.

tags: Set[String]

Custom tags for the DNS record. This field has no effect on DNS responses.

data: Attributes

Components of a CAA record.

flags: Dynamic Float64 | String

Flags for the CAA record.

tag: String

Name of the property controlled by this record (e.g.: issue, issuewild, iodef).

value: String

Value of the record. This field's semantics depend on the chosen tag.

algorithm: Float64

Algorithm.

certificate: String

Certificate.

key_tag: Float64

Key Tag.

type: Float64

Type.

protocol: Float64

Protocol.

public_key: String

Public Key.

digest: String

Digest.

digest_type: Float64

Digest Type.

priority: Float64

Priority.

target: String

Target.

altitude: Float64

Altitude of location in meters.

lat_degrees: Float64

Degrees of latitude.

lat_direction: String

Latitude direction.

lat_minutes: Float64

Minutes of latitude.

lat_seconds: Float64

Seconds of latitude.

long_degrees: Float64

Degrees of longitude.

long_direction: String

Longitude direction.

long_minutes: Float64

Minutes of longitude.

long_seconds: Float64

Seconds of longitude.

precision_horz: Float64

Horizontal precision of location.

precision_vert: Float64

Vertical precision of location.

size: Float64

Size of location in meters.

order: Float64

Order.

preference: Float64

Preference.

regex: String

Regex.

replacement: String

Replacement.

service: String

Service.

matching_type: Float64

Matching Type.

selector: Float64

Selector.

usage: Float64

Usage.

port: Float64

The port of the service.

weight: Float64

The record weight.

fingerprint: String

Fingerprint.

settings: Attributes

Settings for the DNS record.

ipv4_only: Bool

When enabled, only A records will be generated, and AAAA records will not be created. This setting is intended for exceptional cases. Note that this option only applies to proxied records and it has no effect on whether Cloudflare communicates with the origin using IPv4 or IPv6.

ipv6_only: Bool

When enabled, only AAAA records will be generated, and A records will not be created. This setting is intended for exceptional cases. Note that this option only applies to proxied records and it has no effect on whether Cloudflare communicates with the origin using IPv4 or IPv6.

flatten_cname: Bool

If enabled, causes the CNAME record to be resolved externally and the resulting address records (e.g., A and AAAA) to be returned instead of the CNAME record itself. This setting is unavailable for proxied records, since they are always flattened.

meta: JSON

Extra Cloudflare-specific information about the record.

cloudflare_dns_record

data "cloudflare_dns_record" "example_dns_record" {
  zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
  dns_record_id = "023e105f4ecef8ad9ca31a8372d0c353"
}

data cloudflare_dns_records

required Expand Collapse
zone_id: String

Identifier.

optional Expand Collapse
type?: String

Record type.

comment?: Attributes
absent?: String

If this parameter is present, only records without a comment are returned.

contains?: String

Substring of the DNS record comment. Comment filters are case-insensitive.

endswith?: String

Suffix of the DNS record comment. Comment filters are case-insensitive.

exact?: String

Exact value of the DNS record comment. Comment filters are case-insensitive.

present?: String

If this parameter is present, only records with a comment are returned.

startswith?: String

Prefix of the DNS record comment. Comment filters are case-insensitive.

content?: Attributes
contains?: String

Substring of the DNS record content. Content filters are case-insensitive.

endswith?: String

Suffix of the DNS record content. Content filters are case-insensitive.

exact?: String

Exact value of the DNS record content. Content filters are case-insensitive.

startswith?: String

Prefix of the DNS record content. Content filters are case-insensitive.

name?: Attributes
contains?: String

Substring of the DNS record name. Name filters are case-insensitive.

endswith?: String

Suffix of the DNS record name. Name filters are case-insensitive.

exact?: String

Exact value of the DNS record name. Name filters are case-insensitive.

startswith?: String

Prefix of the DNS record name. Name filters are case-insensitive.

tag?: Attributes
absent?: String

Name of a tag which must not be present on the DNS record. Tag filters are case-insensitive.

contains?: String

A tag and value, of the form <tag-name>:<tag-value>. The API will only return DNS records that have a tag named <tag-name> whose value contains <tag-value>. Tag filters are case-insensitive.

endswith?: String

A tag and value, of the form <tag-name>:<tag-value>. The API will only return DNS records that have a tag named <tag-name> whose value ends with <tag-value>. Tag filters are case-insensitive.

exact?: String

A tag and value, of the form <tag-name>:<tag-value>. The API will only return DNS records that have a tag named <tag-name> whose value is <tag-value>. Tag filters are case-insensitive.

present?: String

Name of a tag which must be present on the DNS record. Tag filters are case-insensitive.

startswith?: String

A tag and value, of the form <tag-name>:<tag-value>. The API will only return DNS records that have a tag named <tag-name> whose value starts with <tag-value>. Tag filters are case-insensitive.

direction?: String

Direction to order DNS records in.

match?: String

Whether to match all search requirements or at least one (any). If set to all, acts like a logical AND between filters. If set to any, acts like a logical OR instead. Note that the interaction between tag filters is controlled by the tag-match parameter instead.

order?: String

Field to order DNS records by.

proxied?: Bool

Whether the record is receiving the performance and security benefits of Cloudflare.

tag_match?: String

Whether to match all tag search requirements or at least one (any). If set to all, acts like a logical AND between tag filters. If set to any, acts like a logical OR instead. Note that the regular match parameter is still used to combine the resulting condition with other filters that aren't related to tags.

max_items?: Int64

Max items to fetch, default: 1000

computed Expand Collapse
result: List[Attributes]

The items returned by the data source

name: String

Complete DNS record name, including the zone name, in Punycode.

ttl: Float64

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.

type: String

Record type.

comment: String

Comments or notes about the DNS record. This field has no effect on DNS responses.

content: String

A valid IPv4 address.

private_routing: Bool

Enables private network routing to the origin.

proxied: Bool

Whether the record is receiving the performance and security benefits of Cloudflare.

settings: Attributes

Settings for the DNS record.

ipv4_only: Bool

When enabled, only A records will be generated, and AAAA records will not be created. This setting is intended for exceptional cases. Note that this option only applies to proxied records and it has no effect on whether Cloudflare communicates with the origin using IPv4 or IPv6.

ipv6_only: Bool

When enabled, only AAAA records will be generated, and A records will not be created. This setting is intended for exceptional cases. Note that this option only applies to proxied records and it has no effect on whether Cloudflare communicates with the origin using IPv4 or IPv6.

flatten_cname: Bool

If enabled, causes the CNAME record to be resolved externally and the resulting address records (e.g., A and AAAA) to be returned instead of the CNAME record itself. This setting is unavailable for proxied records, since they are always flattened.

tags: Set[String]

Custom tags for the DNS record. This field has no effect on DNS responses.

id: String

Identifier.

created_on: Time

When the record was created.

meta: JSON

Extra Cloudflare-specific information about the record.

modified_on: Time

When the record was last modified.

proxiable: Bool

Whether the record can be proxied by Cloudflare or not.

comment_modified_on: Time

When the record comment was last modified. Omitted if there is no comment.

tags_modified_on: Time

When the record tags were last modified. Omitted if there are no tags.

priority: Float64

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.

data: Attributes

Components of a CAA record.

flags: Dynamic Float64 | String

Flags for the CAA record.

tag: String

Name of the property controlled by this record (e.g.: issue, issuewild, iodef).

value: String

Value of the record. This field's semantics depend on the chosen tag.

algorithm: Float64

Algorithm.

certificate: String

Certificate.

key_tag: Float64

Key Tag.

type: Float64

Type.

protocol: Float64

Protocol.

public_key: String

Public Key.

digest: String

Digest.

digest_type: Float64

Digest Type.

priority: Float64

Priority.

target: String

Target.

altitude: Float64

Altitude of location in meters.

lat_degrees: Float64

Degrees of latitude.

lat_direction: String

Latitude direction.

lat_minutes: Float64

Minutes of latitude.

lat_seconds: Float64

Seconds of latitude.

long_degrees: Float64

Degrees of longitude.

long_direction: String

Longitude direction.

long_minutes: Float64

Minutes of longitude.

long_seconds: Float64

Seconds of longitude.

precision_horz: Float64

Horizontal precision of location.

precision_vert: Float64

Vertical precision of location.

size: Float64

Size of location in meters.

order: Float64

Order.

preference: Float64

Preference.

regex: String

Regex.

replacement: String

Replacement.

service: String

Service.

matching_type: Float64

Matching Type.

selector: Float64

Selector.

usage: Float64

Usage.

port: Float64

The port of the service.

weight: Float64

The record weight.

fingerprint: String

Fingerprint.

cloudflare_dns_records

data "cloudflare_dns_records" "example_dns_records" {
  zone_id = "023e105f4ecef8ad9ca31a8372d0c353"
  comment = {
    absent = "absent"
    contains = "ello, worl"
    endswith = "o, world"
    exact = "Hello, world"
    present = "present"
    startswith = "Hello, w"
  }
  content = {
    contains = "7.0.0."
    endswith = ".0.1"
    exact = "127.0.0.1"
    startswith = "127.0."
  }
  name = {
    contains = "w.example."
    endswith = ".example.com"
    exact = "www.example.com"
    startswith = "www.example"
  }
  search = "www.cloudflare.com"
  tag = {
    absent = "important"
    contains = "greeting:ello, worl"
    endswith = "greeting:o, world"
    exact = "greeting:Hello, world"
    present = "important"
    startswith = "greeting:Hello, w"
  }
  type = "A"
}