Provides a Cloudflare record resource.
# Add a record to the domain
resource "cloudflare_record" "example" {
zone_id = var.cloudflare_zone_id
name = "terraform"
value = "192.0.2.1"
type = "A"
ttl = 3600
}
# Add a record requiring a data map
resource "cloudflare_record" "_sip_tls" {
zone_id = var.cloudflare_zone_id
name = "_sip._tls"
type = "SRV"
data {
service = "_sip"
proto = "_tls"
name = "terraform-srv"
priority = 0
weight = 0
port = 443
target = "example.com"
}
}
name
(String) The name of the record. Modifying this attribute will force creation of a new resource.type
(String) The type of the record. Available values: A
, AAAA
, CAA
, CNAME
, TXT
, SRV
, LOC
, MX
, NS
, SPF
, CERT
, DNSKEY
, DS
, NAPTR
, SMIMEA
, SSHFP
, TLSA
, URI
, PTR
, HTTPS
, SVCB
. Modifying this attribute will force creation of a new resource.zone_id
(String) The zone identifier to target for the resource. Modifying this attribute will force creation of a new resource.allow_overwrite
(Boolean) Allow creation of this record in Terraform to overwrite an existing record, if any. This does not affect the ability to update the record in Terraform and does not prevent other resources within Terraform or manual changes outside Terraform from overwriting this record. This configuration is not recommended for most environments. Defaults to false
.comment
(String) Comments or notes about the DNS record. This field has no effect on DNS responses.data
(Block List, Max: 1) Map of attributes that constitute the record value. Conflicts with value
. (see below for nested schema)priority
(Number) The priority of the record.proxied
(Boolean) Whether the record gets Cloudflare's origin protection.tags
(Set of String) Custom tags for the DNS record.timeouts
(Block, Optional) (see below for nested schema)ttl
(Number) The TTL of the record.value
(String) The value of the record. Conflicts with data
.created_on
(String) The RFC3339 timestamp of when the record was created.hostname
(String) The FQDN of the record.id
(String) The ID of this resource.metadata
(Map of String) A key-value map of string metadata Cloudflare associates with the record.modified_on
(String) The RFC3339 timestamp of when the record was last modified.proxiable
(Boolean) Shows whether this record can be proxied.data
Optional:
algorithm
(Number)altitude
(Number)certificate
(String)content
(String)digest
(String)digest_type
(Number)fingerprint
(String)flags
(String)key_tag
(Number)lat_degrees
(Number)lat_direction
(String)lat_minutes
(Number)lat_seconds
(Number)long_degrees
(Number)long_direction
(String)long_minutes
(Number)long_seconds
(Number)matching_type
(Number)name
(String)order
(Number)port
(Number)precision_horz
(Number)precision_vert
(Number)preference
(Number)priority
(Number)proto
(String)protocol
(Number)public_key
(String)regex
(String)replacement
(String)selector
(Number)service
(String)size
(Number)tag
(String)target
(String)type
(Number)usage
(Number)value
(String)weight
(Number)timeouts
Optional:
create
(String)update
(String)Import is supported using the following syntax:
$ terraform import cloudflare_record.example <zone_id>/<record_id>