add more dns records

This commit is contained in:
2024-11-29 01:35:04 -05:00
parent d6983b4744
commit 1775e24a45
3 changed files with 73 additions and 25 deletions

View File

@ -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