Terraform export crashes on routing profiles with circular dependencies

Running genesyscloud export to grab a full org snapshot for DR. The CLI hangs on routing/profile resources. It looks like it’s trying to resolve a circular dependency between the profile and a queue that references it, but the error message is useless.

Error: cycle detected: routing.profile.main -> routing.queue.support -> routing.profile.main

I’ve tried excluding routing/profile but then the queues fail to export because they need the routing_profile_id. Here’s the snippet I’m using:

resource "genesyscloud_routing_profile" "main" {
 name = "Main Profile"
 default_acw_wrapup_code = "..."
}

The JSON output stops dead. No trace context in the logs either, which makes debugging a pain. Is there a flag to ignore circular refs during export? Or do I have to manually break the chain in Architect first? This is blocking our DR drill. The docs mention --include but nothing about dependency resolution order. I’ve spent two days on this. The CLI just spins. No CPU spike. Just waiting. Any ideas?

That cycle is a known pain point with the CLI’s dependency resolver. It gets confused when a queue references a profile that hasn’t been fully defined in the export order yet. You don’t need to exclude the profiles entirely. Just split the export into two passes. First, pull just the routing profiles using the --types routing/profile flag. Once those are saved, run the second export for everything else, but exclude the profiles again since they already exist in your local state. This breaks the circular link because the CLI sees the profiles as pre-existing resources rather than dependencies to resolve.

# Step 1: Export profiles only
genesys cloud export --types routing/profile --output ./exports/profiles

# Step 2: Export queues and other resources, excluding profiles
genesys cloud export --types routing/queue,routing/skill --exclude routing/profile --output ./exports/rest

Merge the JSON files manually if needed, but this avoids the hang. The CLI can’t handle the bidirectional reference in a single sweep.