Terraform Genesys Provider: for_each with YAML for multiple queues

Hey folks,

Trying to spin up a bunch of queues using the Genesys Cloud Terraform provider and a YAML file as the source of truth. We’ve got about 40 queues to create, and hardcoding them in HCL is definitely not the way to go. I’ve got a queues.yaml file that looks something like this:

queues:
 - name: Sales_Support
 description: "First line sales support"
 wrap_up_code: "Transfer"
 - name: Tech_Support
 description: "L2 technical issues"
 wrap_up_code: "Resolve"

My plan is to use for_each in the genesyscloud_queue resource to iterate over this list. I’m loading the YAML file using file() and yamldecode() in the variables block.

Here’s the snippet I’m working with:

variable "queue_config" {
 type = any
 default = yamldecode(file("${path.module}/queues.yaml"))
}

resource "genesyscloud_queue" "this" {
 for_each = var.queue_config.queues

 name = each.value.name
 description = each.value.description
 wrap_up_code = each.value.wrap_up_code
}

The issue is that for_each expects a map or a set of strings, but yamldecode returns a list of maps. Terraform is throwing a validation error saying for_each value map does not contain a key for the current item. I tried converting it to a map using zipmap, but I don’t have a unique ID in the YAML yet, just the name. Using the name as the key feels risky if we rename a queue later, since Terraform would see it as a destroy and recreate rather than an update.

Is there a clean way to handle this? Should I add a id field to the YAML just for Terraform’s sake, or is there a better pattern for iterating over a list of maps in this provider? I’ve seen people use index() to create a synthetic key, but that seems fragile if the order changes.

Any pointers appreciated. I’m probably overthinking the key generation part. Just want to avoid accidental queue deletions during plan apply.