Difference between revisions of "Terraform resource: cloudflare record"

From wikieduonline
Jump to navigation Jump to search
Line 6: Line 6:
  
 
  {{cloudflare_record_example}}
 
  {{cloudflare_record_example}}
 +
 +
 +
# 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"
 +
  }
 +
}
  
 
== See also ==
 
== See also ==

Revision as of 11:22, 8 March 2024

https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs/resources/record

proxied

Official example

 resource "cloudflare_record" "example" {
 zone_id = var.cloudflare_zone_id
 name    = "terraform"
 value   = "192.0.2.1"
 type    = "A"
 ttl     = 3600
}


# 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"
 }
}

See also

Advertising: