Running into a weird issue with the genesyscloud Terraform provider where a data source lookup by name is failing because it finds multiple resources. I’m trying to reference an existing IVR flow to attach it to a new routing strategy, but the lookup isn’t deterministic.
The setup is standard: I have a data source block that queries the IVR flows. The problem is that two different flows in our dev environment have very similar names, or perhaps there’s a caching issue with the provider’s internal state. It throws a panic during the plan phase instead of just warning me.
Error: Multiple data sources found
with data.genesyscloud_ivr_flow.main,
on main.tf line 4, in data "genesyscloud_ivr_flow" "main":
4: name = "Global IVR Router"
Multiple matching resources found. Please use a more specific filter or unique name.
Here is the snippet I’m using:
data "genesyscloud_ivr_flow" "main" {
name = "Global IVR Router"
}
resource "genesyscloud_routing_strategy" "test" {
name = "Test Strategy"
ivr_flow_id = data.genesyscloud_ivr_flow.main.id
}
I know I can use the id directly, but that breaks our CI/CD pipeline which relies on dynamic lookups to avoid hardcoding IDs that change across environments. The docs suggest the name filter should be unique, but it clearly isn’t in this case. Is there a way to add a secondary filter like description or version to narrow it down? Or is this a bug in the provider’s handling of the /api/v2/flows/ivr endpoint?
The goal is to keep the Terraform config clean and avoid manual ID updates. Currently, I have to manually check the Genesys Cloud UI to see which ID is which, which is annoying. The error stops the plan dead, so I can’t even see what the other matching resource is.
I’ve tried adding a description filter, but the provider schema for genesyscloud_ivr_flow data source doesn’t seem to support it. Only name is listed as an argument. If I can’t filter by description, how am I supposed to handle non-unique names? The provider should probably fail more gracefully or allow multiple filters. Right now it’s just blocking the deployment.
Anyone else hit this with IVR flows or routing strategies? Using provider version 1.0.12. The API call itself returns a list, so the provider has the data, it’s just not exposing the filtering options. Maybe I’m missing a hidden argument?