26 lines
654 B
Terraform
26 lines
654 B
Terraform
|
terraform {
|
||
|
required_providers {
|
||
|
cloudflare = {
|
||
|
source = "cloudflare/cloudflare"
|
||
|
version = "~> 4.0"
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
data "cloudflare_zone" "zone" {
|
||
|
name = var.dns_zone
|
||
|
}
|
||
|
|
||
|
resource "cloudflare_record" "records" {
|
||
|
count = length(var.dns_records)
|
||
|
|
||
|
zone_id = data.cloudflare_zone.zone.zone_id
|
||
|
name = var.dns_records[count.index].name
|
||
|
type = var.dns_records[count.index].type
|
||
|
value = var.dns_records[count.index].value
|
||
|
ttl = lookup(var.dns_records[count.index], "ttl", null)
|
||
|
priority = lookup(var.dns_records[count.index], "priority", null)
|
||
|
|
||
|
proxied = lookup(var.dns_records[count.index], "proxied", true)
|
||
|
}
|