Why does the genesyscloud_routing_queue resource throws an attribute lookup error when using for_each with a YAML-sourced variable file?
I am trying to generate multiple queues from a single YAML definition file to keep our CX as Code config DRY. The variable file queues.yaml contains a list of objects with name, description, and outbound_capacity.
Here is the TF block:
variable "queues" {
type = any
}
resource "genesyscloud_routing_queue" "dynamic_queues" {
for_each = var.queues
name = each.value.name
description = each.value.description
outbound_capacity = each.value.outbound_capacity
}
When I run terraform plan, it fails with:
Error: Unsupported attribute. This object does not have an attribute named "name".
I have verified the YAML structure is valid JSON-compatible objects. I am passing the file using -var-file=queues.yaml. The error suggests var.queues is being treated as a list or a single object rather than a map, but for_each expects a map or set of strings.
How do I correctly map a list of YAML objects into a structure that for_each accepts for the queue resource? I am in Paris, so if this is a timezone-sensitive parsing issue, I am awake to debug it.
Thanks everyone.