Trying to drive queue creation from a YAML file using for_each. The YAML defines a map of queue names to config blocks. When I try to reference each.value inside the resource block to set outbound_call settings, Terraform complains about an unknown value during the plan phase, even though the file is static.
Here’s the simplified structure:
locals {
queues = yamldecode(file("queues.yaml"))
}
resource "genesyscloud_queue" "this" {
for_each = local.queues
name = each.value.name
outbound_call {
enabled = each.value.outbound_enabled
# Error happens here
}
}
The error is each.value.outbound_enabled is known only after apply. Why does Terraform treat a static YAML value as dynamic when accessed inside the resource block with for_each? I’ve tried wrapping it in try() but that doesn’t help. Is there a way to force the evaluation order or structure the YAML differently so the attributes are resolved at plan time?