Trying to automate disaster recovery for our org using the Genesys Cloud Terraform provider. The goal is to export the full state, tweak some IDs, and re-import if the org goes down or we need a clean slate for testing.
I’ve got a script that iterates through the /api/v2/ endpoints to grab resources, but when I try to terraform import a batch of dependent resources (like routing queues and their associated flows), it falls over.
Here’s the error I’m hitting on the queue resource:
Error: resource "genesyscloud_routing_queue" "my_queue" not found
on main.tf line 10, in resource "genesyscloud_routing_queue" "my_queue":
10: resource "genesyscloud_routing_queue" "my_queue" {
The weird thing is the queue exists. I can see it in the UI and via the API. But the provider seems to expect a specific state file structure or maybe the dependencies aren’t resolved in the right order during the import phase.
Is there a recommended way to bulk import an org’s configuration without manually specifying every single dependency chain? I’ve tried sorting by resource type (users → groups → queues → flows) but it still chokes on circular references between flows and queues.
Also noticed the genesyscloud provider doesn’t have a built-in “export org” command like some other SaaS providers do. Am I missing a flag or is this just a manual process of writing a custom script to parse the JSON and generate HCL?
Here’s a snippet of my current import loop logic:
for resource in resources:
tf_resource_type = map_tf_type(resource['type'])
tf_resource_name = resource['id']
exec(f"terraform import {tf_resource_type}.{tf_resource_name} {resource['id']}")
It works for standalone resources but fails hard on anything with dependencies. Any tips on handling the dependency graph during import?