Trying to spin up multiple queues from a YAML file. The variable is defined as any to keep it flexible, but the for_each block throws a type mismatch error when parsing the list.
Variable definition:
variable "queues" {
type = any
}
Queue resource:
resource "genesyscloud_routing_queue" "dynamic_queues" {
for_each = var.queues
name = each.value.name
description = each.value.desc
}
The YAML input looks like this:
- name: "Support-EN"
desc: "English Support"
- name: "Support-ES"
desc: "Spanish Support"
Error message:
Error: Incorrect attribute value type. Inappropriate value for attribute "for_each": object required.
I know for_each expects a map or set of strings. How do I structure the YAML or the HCL so it accepts a list of objects without writing a separate variable for every single queue? flatten didn’t work because I need unique keys for state tracking.