Terraform for_each with YAML file for multiple CXone queues

I’m trying to spin up a bunch of queues using for_each in Terraform. The names and skills live in a YAML file. I load it with yamldecode(file("queues.yaml")).

The map structure looks right in the locals, but Terraform complains about the type when I pass it to the genesyscloud_queue resource. I’m getting a ‘incompatible types’ error on the name attribute.

Here’s the :

resource "genesyscloud_queue" "main" {
 for_each = var.queues
 name = each.value.name
}

What am I missing? The YAML keys are strings. The values are objects. It should work.