infrastructure/ingress.tjo.cloud/nodes.tf
Tine cc12c5d30d
Some checks failed
/ lint (push) Failing after 2m28s
feat: wip
2024-08-04 19:50:50 +02:00

28 lines
637 B
HCL

locals {
locations = {
DE = ["46.4.88.62", "2a01:4f8:202:2395::"]
SI = ["93.103.125.118", "2a01:261:455:6c00:21e:6ff:fe45:c34"]
}
}
data "digitalocean_domain" "ingress" {
name = "ingress.tjo.cloud"
}
resource "digitalocean_record" "locations" {
for_each = merge([
for location, ips in local.locations : {
for ip in ips : "${location} at ${ip}" => {
location = location,
ip = ip,
}
}
]...)
domain = data.digitalocean_domain.ingress.id
type = strcontains(each.value.ip, ":") ? "AAAA" : "A"
name = lower(each.value.location)
value = each.value.ip
ttl = 60
}