Stumbled on a weird bug today with my Terraform setup for Genesys Cloud. I’m trying to reference an existing queue by name using a data source, but it keeps throwing an error saying no matches were found. I’ve verified the queue exists and the name matches exactly, including casing.
error: no matching resources found for data source 'genesyscloud_routing_queue.queue_lookup'
Here is the snippet:
resource "genesyscloud_routing_queue" "my_queue" {
name = "Support-Team-1"
...
}
data "genesyscloud_routing_queue" "queue_lookup" {
name = "Support-Team-1"
}
Is there a delay in indexing or a specific attribute I need to set for the data source to pick up the resource? The apply succeeds for the resource creation, but subsequent runs fail on the data source lookup.
Yep, this is a known issue with the terraform provider’s internal search logic. it often fails if the queue name contains special characters or if the search scope isn’t explicitly defined. instead of relying on the genesyscloud_routing_queue data source which does a fuzzy match by default, try using the genesyscloud_routing_queue resource with a depends_on block or look up the id directly via the api.
here is a more robust approach using the genesyscloud_routing_queue data source with explicit filters:
data "genesyscloud_routing_queue" "lookup" {
name = "Support Team"
# force a refresh to ensure cache isn't stale
depends_on = [genesyscloud_routing_queue.main]
}
if that still fails, check the api response directly:
curl -X GET "https://api.mypurecloud.com/api/v2/routing/queues?name=Support+Team" \
-H "Authorization: Bearer $TOKEN"
the error usually stems from the provider not handling pagination correctly when multiple queues share similar names. ensure your queue name is unique across the organization.