Terraform for_each with YAML var file creates duplicate queues

I’m trying to move some queue definitions into a YAML variable file to keep the state clean. The plan runs fine, but the apply step fails because it tries to create queues that already exist or conflicts on the name field.

Here is the variable definition:

variable "queues_config" {
 type = map(object({
 name = string
 description = string
 enabled = bool
 }))
 default = {}
}

And the resource block:

resource "genesyscloud_routing_queue" "dynamic_queues" {
 for_each = var.queues_config

 name = each.value.name
 description = each.value.description
 enabled = each.value.enabled
}

The YAML file looks like this:

queues_config:
 support_us:
 name: "US Support"
 description: "General support for US"
 enabled: true
 sales_eu:
 name: "EU Sales"
 description: "Sales team for Europe"
 enabled: true

When I run terraform plan, it shows 2 to add. When I run terraform apply, the first one succeeds. The second one fails with:

Error: Error creating Queue: 409 Conflict
Details: A Queue with that name already exists.

This is strange because the names are different. I checked the API directly with GET /api/v2/routing/queues and only see the first one. It seems like the for_each is not iterating correctly or the provider is caching something. I’ve tried destroying and recreating, same issue.

Is there a specific way to handle the for_each key with complex objects in the CXone provider? Or am I missing a unique identifier field that’s required beyond just the name?