Error: Inappropriate value for attribute “description”: string required.
I am trying to provision multiple Genesys Cloud queues from a YAML variable file using for_each in the genesyscloud provider. I have a queues.yml file that looks like this:
queues:
- name: "Support US"
description: "US Support Queue"
wrap_up_timeout: 45
- name: "Support BR"
description: "Brazil Support Queue"
wrap_up_timeout: 60
My Terraform code attempts to parse this and iterate:
locals {
queue_list = yamldecode(file("${path.module}/queues.yml"))
}
resource "genesyscloud_routing_queue" "this" {
for_each = toset(local.queue_list.queues[*].name)
name = each.value
description = local.queue_list.queues[each.key].description
wrap_up_timeout = local.queue_list.queues[each.key].wrap_up_timeout
}
The plan fails immediately. The each.value is a string (the name), but I am trying to access the full object via each.key which is also just the string name. I know for_each expects a map of objects to properly index the other fields like description. How do I convert the YAML list into a proper map keyed by name so I can reference the other attributes inside the resource block? I am used to React Native state management, this Terraform typing is frustrating.