Hey folks,
Trying to spin up a batch of queues from a YAML file instead of hardcoding them in HCL. I’ve got a queues.yaml that looks like this:
queues:
sales_east:
name: Sales East
description: East coast sales team
sales_west:
name: Sales West
description: West coast sales team
I’m using yamldecode(file("queues.yaml")) to load it into a local variable. The plan is to use for_each on the genesyscloud_routing_queue resource. But I’m stuck on the syntax. When I try to reference the nested map, Terraform complains about the type.
Here’s what I’ve got so far:
locals {
queue_data = yamldecode(file("queues.yaml")).queues
}
resource "genesyscloud_routing_queue" "dynamic_queues" {
for_each = local.queue_data
name = each.value.name
}
It fails with Inappropriate value for attribute "for_each": must be a map or set of strings, but have a map of object. I get that each.value is an object, not a string key. Should I be using keys() and then looking up the values inside the resource block? Or is there a cleaner way to handle nested YAML maps with for_each in the Genesys provider? Feels like I’m missing a basic pattern here.