Genesyscloud provider export_plan returns empty state for DR backup

I can’t seem to figure out why terraform plan -out=backup.tfplan generates an empty diff despite active queue changes. I am trying to export the entire org configuration for disaster recovery as suggested in docs. My main.tf includes the provider block, but running terraform show yields no resources. Is the state file supposed to capture API configurations automatically, or do I need a specific data source export command first?

You need to understand that Terraform does not auto-discover Genesys Cloud resources. The genesyscloud provider is not a scanner; it is a state manager. If your main.tf is empty, the state is empty. You are likely confusing the provider configuration with resource definition. To export an existing org for DR, you must first use the genesys-cloud-cli to generate the HCL definitions from your live environment, then import those definitions into your Terraform state.

Here is the correct workflow:

  • Install the official CLI: go install github.com/mygenesys/gc-cli/cmd/gc-cli@latest
  • Authenticate and export your configuration to a directory: gc-cli export -d ./dr-export
  • Review the generated .tf files. They will contain resource blocks for every queue, user, and routing profile.
  • Initialize Terraform in that directory: terraform init
  • Import the state for a specific resource to sync it: terraform import genesyscloud_routing_queue.main_queue <queue-id>

The export_plan command you mentioned is not a standard Terraform command. You likely mean terraform plan. If the plan is empty, it means the code matches the state. Since you have no code, the state is empty.

Do not try to write HCL manually for a full org export. Use the CLI export tool. It handles the complex dependencies between users, queues, and routing profiles.

# Example of what the CLI generates for a queue
resource "genesyscloud_routing_queue" "support_queue" {
 name = "Support"
 description = "Main support queue"
 enabled = true
 flow_id = data.genesyscloud_flow.support_flow.id
 wrap_up_timeout = "PT30S"
}

Run gc-cli export first. Then run terraform plan. If you see changes, it means the exported HCL does not match the live state. Fix the HCL or run terraform import for the missing IDs. This is the only reliable way to build a DR backup strategy with Terraform.

The simplest way to resolve this is to bypass the CLI and use the Python SDK to fetch the queue state directly. Run platformClient.routing.getRoutingQueues() and dump the JSON. Note: this does not generate HCL automatically, so you still need to map the attributes manually for Terraform. I usually validate the data structure in pandas first to ensure all fields are captured correctly before writing the config.

The documentation actually says you need to run genesys-cloud-cli resource export first, otherwise Terraform has nothing to compare against.

$ terraform plan
No changes. Your infrastructure matches the configuration.

This is a standard case of expecting Terraform to magically ingest Genesys Cloud state without explicit import commands or prior CLI generation. The genesyscloud provider does not perform background discovery. If your state file is empty, Terraform has no baseline to compare against, resulting in a null plan. You must explicitly populate the state using terraform import or generate the initial HCL via the CLI to establish that baseline.

The risk with relying solely on genesys-cloud-cli resource export for DR is that it often misses implicit dependencies or custom attributes that are not standard in the API schema. A more robust approach for a DevOps pipeline is to use the provider’s data sources to pull real-time IDs and then import them. Here is a pattern to safely import a queue into state without manual ID lookup:

data "genesyscloud_routing_queue" "example" {
 name = "Support Queue"
}

resource "genesyscloud_routing_queue" "imported" {
 name = data.genesyscloud_routing_queue.example.name
 description = data.genesyscloud_routing_queue.example.description
 # Add other required attributes
}

Run terraform import genesyscloud_routing_queue.imported ${data.genesyscloud_routing_queue.example.id}. This ensures the state matches the live API configuration exactly. Avoid dumping raw JSON from the SDK as suggested elsewhere; it creates a maintenance nightmare when API versions update. Keep your infrastructure as code strictly in HCL.