2024-08-02 20:10:21 +00:00
|
|
|
locals {
|
|
|
|
listeners = [
|
|
|
|
{
|
2024-08-04 17:50:50 +00:00
|
|
|
domain = "k8s.tjo.cloud"
|
|
|
|
name = "api"
|
|
|
|
locations = ["SI", "DE"]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
domain = "k8s.tjo.cloud"
|
|
|
|
name = "dashboard"
|
|
|
|
locations = ["SI", "DE"]
|
2024-08-02 20:10:21 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "digitalocean_record" "listeners" {
|
2024-08-04 17:50:50 +00:00
|
|
|
for_each = merge(flatten([
|
|
|
|
for listener in local.listeners :
|
|
|
|
[
|
|
|
|
for location in listener.locations : {
|
|
|
|
for ip in local.locations[location] : "${ip} for ${listener.name}.${listener.domain} at ${location}" => {
|
|
|
|
ip = ip
|
2024-08-02 20:10:21 +00:00
|
|
|
domain = listener.domain
|
|
|
|
name = listener.name
|
|
|
|
}
|
|
|
|
}
|
2024-08-04 17:50:50 +00:00
|
|
|
]
|
|
|
|
])...)
|
2024-08-02 20:10:21 +00:00
|
|
|
|
|
|
|
domain = each.value.domain
|
2024-08-04 17:50:50 +00:00
|
|
|
type = strcontains(each.value.ip, ":") ? "AAAA" : "A"
|
2024-08-02 20:10:21 +00:00
|
|
|
name = each.value.name
|
|
|
|
value = each.value.ip
|
2024-08-04 17:50:50 +00:00
|
|
|
ttl = 60
|
2024-08-02 20:10:21 +00:00
|
|
|
}
|