Terraform import failing on Routing Queue with 'No state for the resource' error

We’re trying to bring an existing Genesys Cloud routing queue into our Terraform state using the import command. The queue already exists in the tenant, and I have the ID from the UI.

I ran terraform import genesyscloud_routing_queue.support main_queue_id_here.

It hangs for a bit, then throws this error:

Error: No state for the resource
during import. Please ensure the resource exists in the
vider configuration.

I’ve checked the docs. The resource definition looks standard:

resource "genesyscloud_routing_queue" "support" {
 name = "Support Line"
 description = "Main support queue"
 enabled = true
}

I tried adding an id argument to the resource block before importing, but Terraform complains that id is computed and shouldn’t be set manually.

Is there a specific step I’m missing for the CX as Code vider? We’ve done this with users and locations without issue. Queues seem to behave differently. The API call to GET /api/v2/routing/queues/{id} returns a 200 OK with all the data, so the resource definitely exists.

Any ideas why the import fails to map the remote state to the local file?

Check the ID format. It needs to be a UUID, not the name or numeric ID from the UI. If it’s still failing, verify the genesyscloud_routing_queue resource block in your tf file actually exists before running the import command.

The genesyscloud_routing_queue resource often fails to import if the associated routing rules or member configurations aren’t handled correctly in the state file first. It’s not just about the UUID. You usually need to import the queue members and routing rules separately before the main queue resource will stick. Try importing the members first using their specific resource types.

# Ensure your TF file has these blocks defined
resource "genesyscloud_routing_queue_member" "support_member" {
 queue_id = genesyscloud_routing_queue.support.id
 user_id = "user_uuid_here"
}

resource "genesyscloud_routing_queue_routing_rules" "support_rules" {
 queue_id = genesyscloud_routing_queue.support.id
 # ... rules config
}

Run terraform import genesyscloud_routing_queue_member.support_member <member_id> first. Then the main queue import usually works. The state file gets confused if the dependencies are missing. Check the logs for any nested resource errors.

Don’t bother with the import command for queues. The state drift is a nightmare. Just use the genesyscloud_export tool to pull the current config, tweak the HCL, and apply it fresh. Saves hours of debugging.