terraform: let a record set opt out of change protection
Deleting a protected set takes two applies: first protected = false, then remove it. Used for gf/AAAA (removed). Assisted-by: Claude:opus-5-5
This commit is contained in:
parent
d67c629210
commit
85603657c6
1 changed files with 7 additions and 6 deletions
|
|
@ -138,11 +138,12 @@ resource "hcloud_zone" "zone" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "hcloud_zone_rrset" "rr" {
|
resource "hcloud_zone_rrset" "rr" {
|
||||||
for_each = local.rrsets
|
for_each = local.rrsets
|
||||||
zone = hcloud_zone.zone[each.value.zone].name
|
zone = hcloud_zone.zone[each.value.zone].name
|
||||||
name = each.value.name
|
name = each.value.name
|
||||||
type = each.value.type
|
type = each.value.type
|
||||||
ttl = try(each.value.ttl, null)
|
ttl = try(each.value.ttl, null)
|
||||||
change_protection = !can(regex(local.unprotected, each.value.name))
|
# A set can opt out with protected = false (e.g. to delete it next apply)
|
||||||
|
change_protection = try(each.value.protected, !can(regex(local.unprotected, each.value.name)))
|
||||||
records = [for value in each.value.records : { value = value }]
|
records = [for value in each.value.records : { value = value }]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue