Trying to understand why my terraform plan keeps blowing up when i pass a yaml variable file into a for_each block for genesyscloud_queue resources. i am pulling queue configurations from a local yaml file using the yamldecode function then iterating over the map to spin up multiple routing queues. the syntax looks correct to me but the apply phase throws a 409 conflict error on the second iteration.
here is the relevant config:
variable "queue_configs" {
type = any
default = file("${path.module}/queues.yaml")
}
resource "genesyscloud_routing_queue" "dynamic_queues" {
for_each = yamldecode(var.queue_configs)
name = each.value.name
email = each.value.email
description = each.value.description
enabled = true
}
the yaml file contains a simple map of queue ids to attributes when i run terraform apply the first queue provisions successfully via the /api/v2/routing/queues endpoint but subsequent iterations fail with duplicate name validation errors even though the names are distinct in the yaml. i have verified the payload structure matches the sdk schema exactly.
could this be a race condition in the cx as code provider where it does not wait for the previous api call to fully commit before firing the next request i am running terraform v1.7.4 with the genesyscloud provider v1.15.0. the notification routing layer i am building depends on these queues being provisioned atomically before my tokio websocket client starts subscribing to the queue event stream. any pointers on how to force sequential execution or handle the yaml iteration properly would be appreciated i am not seeing any provider logs that indicate throttling or retry logic.