Running into a weird issue with the Genesys Cloud Terraform provider. I’m trying to reference an existing routing strategy using a data source lookup by name, but the resulting block is coming back empty when I try to use it in a resource definition.
Here is the setup. I have a routing strategy named “Priority Queue Logic” that already exists in the org. I want to attach it to a new queue without hardcoding the ID.
data "genesyscloud_routing_strategy" "priority_logic" {
name = "Priority Queue Logic"
}
resource "genesyscloud_routing_queue" "test_queue" {
name = "Test Queue - Priority"
routing_strategy_id = data.genesyscloud_routing_strategy.priority_logic.id
}
The plan fails with:
Error: Invalid reference
on main.tf line 15, in resource "genesyscloud_routing_queue" "test_queue":
15: routing_strategy_id = data.genesyscloud_routing_strategy.priority_logic.id
A managed resource "genesyscloud_routing_strategy" "priority_logic" has not been declared in the root module.
Wait, that error message is confusing. It says “managed resource” but I’m using a data source. I tried adding the genesyscloud_routing_strategy resource block just to see if it helps, but that creates a conflict since the resource already exists.
I checked the docs and it seems like the data source should just query the API and return the ID. I ran a quick terraform plan with -target=data.genesyscloud_routing_strategy.priority_logic and it seems to find it fine in isolation. The problem only happens when I try to reference the .id attribute in another resource.
Is this a known quirk with how the provider handles data source attributes for routing strategies? Or am I missing a configuration flag? The API call /api/v2/routing/strategies returns the object fine when I test it manually with Postman, so the name match isn’t the issue.