@Evesy wrote:
Hi there,
I have a resource similar to the below which has a dynamic number of
origins
blocks based on some environmental overrides:resource "cloudflare_load_balancer_pool" "delivery-platform" { for_each = var.load_balancer_pools name = "gcp-delivery-platform-${each.key}" description = "GCP Delivery Platform - ${title(each.key)}" enabled = true minimum_origins = 1 notification_email = "" dynamic "origins" { for_each = each.value content { name = origins.key address = origins.value["address"] weight = lookup(origins.value, "weight", 1) } } monitor = cloudflare_load_balancer_monitor.ingress-nginx[each.key].id }
I’m looking to be able to add a lifecycle rule to ignore changes for the
weight
key in all origin blocks.I thought I could perhaps use some sort of splat syntax but that doesn’t seem to be valid:
lifecycle { ignore_changes = [ // origins[*]["weight"] origins[*].weight ] }
The only current workaround I can think of is to add ignore rules for origins
[0], [1], [2]
etc. up to a sensible number that I don’t think will be exceeded.Is anyone aware of a better way to achieve this?
Cheers!
Posts: 1
Participants: 1