So I’m trying to spin up about 15 new queues using the Genesys Cloud Terraform provider and I don’t want to hardcode the genesys_cloud_routing_queue blocks. I figured I’d just dump the queue configs into a YAML file, parse it into a map in my variables.tf, and then use for_each to iterate over it. Sounds clean, right? Wrong.
The moment I try to apply, Terraform throws a fit about a cyclic dependency. It’s complaining that the genesys_cloud_routing_queue resource depends on itself, which makes zero sense because each iteration should be independent. Here’s the setup:
In variables.tf I have:
variable queue_configs {
type = map(object({
description = string
out_of_office = bool
enabled = bool
}))
}
Then in main.tf:
resource "genesys_cloud_routing_queue" "queues" {
for_each = var.queue_configs
name = each.key
description = each.value.description
enabled = each.value.enabled
out_of_office {
enabled = each.value.out_of_office
}
}
The error message is Error: Cycle: genesys_cloud_routing_queue.queues, genesys_cloud_routing_queue.queues. I’ve checked the YAML input and it’s just a flat map of strings and bools. No cross-references, no nested dependencies.
I know the provider has some quirks with how it handles list vs map types, but I thought for_each was the standard way to handle this. I’ve tried switching to count with a list, but then I lose the ability to name the resources cleanly for state management. Is there something specific about the Genesys Cloud provider that breaks for_each on routing queues? Or am I missing a subtle dependency in the resource definition? I’ve been staring at this for two hours and my brain is fried. Any pointers would be huge.