Terraform data source lookup by name for existing Genesys Cloud resources failing with 404

What is the standard approach to reference existing Genesys Cloud resources by name using Terraform data sources when the resource ID is not available in the state? I am working on a Salesforce-to-Genesys integration project where I need to update existing Routing Queues and Users via the Genesys Cloud Terraform provider without importing them into the state file. The goal is to use data sources to fetch the resource ID based on the name, which is stored in Salesforce, and then pass that ID to the genesys_cloud_routing_queue resource for updates. However, when I use the data source with the name attribute, I consistently receive a 404 Not Found error during the terraform plan phase, even though the resource exists and is accessible via the Genesys Cloud UI and the /api/v2/routing/queues endpoint. I have verified that the name matches exactly, including case sensitivity, and I have tried using the search_term attribute as well, but the result is the same. The error message indicates that the resource could not be found, which suggests that the data source might not be searching by name correctly or that there is a limitation in how the provider handles name-based lookups. I am using Terraform version 1.5.0 and the Genesys Cloud provider version 1.30.0. Below is a snippet of my Terraform configuration:

data "genesys_cloud_routing_queue" "existing_queue" {
 name = "Sales Support Queue"
}

resource "genesys_cloud_routing_queue" "queue_update" {
 id = data.genesys_cloud_routing_queue.existing_queue.id
 name = "Sales Support Queue"
 // other attributes...
}

I have also tried using the genesys_cloud_user data source with similar results. Is there a specific way to structure the data source query to ensure it finds the resource by name? Or is there an alternative approach to reference existing resources without importing them into the state? I need a solution that allows me to dynamically fetch the resource ID based on the name, as the names are managed in Salesforce and may change over time. Any insights or workarounds would be greatly appreciated. I have also checked the provider documentation, but it does not provide clear guidance on name-based lookups for data sources. I am currently in the Africa/Lagos timezone, and I am working with a large number of resources, so importing them all into the state is not a viable option. I need a programmatic way to fetch the IDs based on the names that are stored in Salesforce. This is critical for our integration workflow, as we need to ensure that the correct resources are updated in Genesys Cloud based on the data in Salesforce. I have also tried using the depends_on attribute to ensure that the data source is evaluated before the resource, but this does not seem to help. I am looking for a robust solution that can handle name-based lookups reliably. I have also considered using the Genesys Cloud API directly to fetch the resource ID based on the name, but I would prefer to use the Terraform provider if possible. I have also tried using the genesys_cloud_routing_queue data source with the queue_id attribute, but this requires knowing the ID in advance, which defeats the purpose of using a data source. I need a way to fetch the ID based on the name, which is the only attribute that is available from Salesforce. I have also checked the provider issues on GitHub, but I have not found a similar issue. I am hoping that there is a solution that I have missed. I have also tried using the genesys_cloud_routing_queue data source with the name attribute and the search_term attribute, but both have failed with the same error. I am looking for a clear and concise solution to this problem. I have also considered using a custom script to fetch the resource ID from the Genesys Cloud API, but I would prefer to use Terraform if possible. I am hoping that there is a way to make the data source work as expected. I have also tried using the genesys_cloud_routing_queue data source with the name attribute and the search_term attribute, but both have failed with the same error. I am looking for a clear and concise solution to this problem.

The documentation actually says genesyscloud_routing_queue requires the name attribute to match exactly, but it often fails if multiple queues share the same name across different orgs or if soft-deleted records exist. Try using genesyscloud_user with the email attribute instead, as it’s unique and avoids the 404s caused by name collisions.