add more dns records
This commit is contained in:
@ -8,7 +8,7 @@ terraform {
|
||||
}
|
||||
}
|
||||
backend "local" {
|
||||
path = pathexpand("~/Backups/tfstate/cloudflare.tfstate")
|
||||
# path = pathexpand("~/Backups/tfstate/cloudflare.tfstate")
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,6 +23,10 @@ locals {
|
||||
for index, record in distinct(var.dns_records) : # 'distint' removes duplicate values from a list
|
||||
tostring(index) => record
|
||||
}
|
||||
mx_records = {
|
||||
for index, record in distinct(var.mx_records) : # 'distint' removes duplicate values from a list
|
||||
tostring(index) => record
|
||||
}
|
||||
}
|
||||
|
||||
resource "cloudflare_zone" "balsillie_net" {
|
||||
@ -47,4 +51,15 @@ resource "cloudflare_record" "dns_records" {
|
||||
ttl = each.value.ttl
|
||||
}
|
||||
|
||||
resource "cloudflare_record" "mx_records" {
|
||||
for_each = local.mx_records
|
||||
zone_id = cloudflare_zone.balsillie_net.id
|
||||
proxied = false
|
||||
name = each.value.name
|
||||
type = each.value.type
|
||||
content = each.value.content
|
||||
priority = each.value.priority
|
||||
ttl = each.value.ttl
|
||||
}
|
||||
|
||||
# TODO update the SOA record when dns_records resource was changed
|
Reference in New Issue
Block a user