Terraform for_each with YAML var_file causing cyclic dependency on Genesys Queues

Running into a wall with the Genesys Cloud Terraform provider again. Trying to spin up multiple queues from a single YAML config file using for_each.

I’ve got a variables.tf that defines a map of queues:

variable "queue_configs" {
 type = map(object({
 name = string
 description = string
 skills = list(string)
 }))
}

And in main.tf I’m looping through it:

resource "genesyscloud_routing_queue" "queues" {
 for_each = var.queue_configs

 name = each.value.name
 description = each.value.description

 skills {
 for skill in each.value.skills
 skill_id = data.genesyscloud_routing_skill.skills[skill].id
 }
}

The issue is the data source lookup for skills inside the loop. Terraform complains about a cyclic dependency because for_each requires the keys to be known at plan time, but the skill IDs seem to be evaluated too late or in the wrong order when the YAML file is loaded.

Error snippet:

│ Error: Cycle: genesyscloud_routing_queue.queues, data.genesyscloud_routing_skill.skills

I’ve tried moving the skill data source outside the loop and using a single list of all skills, but then I lose the specific skill mapping per queue. The YAML structure is pretty flat, just key-value pairs for each queue name.

How do you guys handle dynamic resource creation with external data lookups in this provider? Is there a way to force the data source evaluation before the for_each expansion?