Terraform CX as Code: State drift when exporting full org config for DR

We are trying to set up a disaster recovery pipeline that exports the entire Genesys Cloud org configuration using the CX as Code provider. The goal is to have a single terraform init and terraform plan that pulls the current state into a local backend, which we can then push to a backup environment if needed.

The problem is that the export process fails with a state drift error almost immediately. We are using the genesyscloud provider version 1.38.0. Here is the basic configuration we are using to trigger the export:

provider "genesyscloud" {
 client_id = var.genesis_client_id
 client_secret = var.genesis_client_secret
 environment = "us"
}

data "genesyscloud_platform_platformsettings" "current" {
}

resource "genesyscloud_routing_queue" "all_queues" {
 for_each = data.genesyscloud_routing_queue.all_queues.queues
 # ... mapping attributes
}

When we run terraform import or try to pull the state, we get a 404 Not Found on several resources that definitely exist in the UI. Specifically, custom attributes and some flow versions are missing from the API response. The error looks like this:

Error: Resource not found: 404 Not Found for resource ID: abc-123-def

We have tried filtering by organization ID, but the provider does not seem to support a global export flag. Is there a known workaround for exporting the full state without manually importing every single resource ID? We need this to be automated for DR purposes.

Cause: The drift isn’t a bug. It’s the provider trying to manage resources that don’t have stable IDs or are read-only in your context. CX as Code exports everything, including system-generated entities that Terraform can’t reconcile cleanly without explicit ignore blocks. You’re likely hitting a mismatch on external_id or a missing depends_on chain for a dependent resource like a flow version.

Solution: Don’t export the whole org in one go. Break it down by resource type. Start with users and queues, then flows. Use lifecycle { ignore_changes = [last_modified_by, last_modified_time] } on every resource block. For flows, ensure you’re exporting the latest version explicitly. Here’s a snippet for a user:

resource "genesyscloud_user" "example" {
 name = "John Doe"
 email = "john@example.com"
 lifecycle {
 ignore_changes = [last_modified_by, last_modified_time]
 }
}

Run terraform state pull to check for orphaned state entries. Clean those up before re-running.