CX as Code Export fails on large org: HTTP 500 on /api/v2/integration/grant

We are trying to set up a disaster recovery pipeline by exporting our entire Genesys Cloud org configuration using the CX as Code provider. The goal is to get a single JSON dump of all resources to store in our S3 bucket for backup purposes.

The documentation for the genesys_cloud provider mentions using the export feature, but the underlying mechanism relies on the integration grant API to fetch the resources. When I run the export command on our production org (which has about 15,000 users and 200 queues), the process hangs for a while and then crashes.

The error I get is:

Error: Failed to export configuration: HTTP 500 Internal Server Error
Response: {"code": 500, "message": "An internal server error occurred."}

I checked the genesys_cloud provider source code and it seems to use this endpoint to get the resources:

GET /api/v2/integration/grant

But wait, that’s the endpoint for getting a token or grant info? No, the export function calls a different internal endpoint that batches the resources. The docs say: “Exporting large organizations may take several minutes. Ensure your timeout settings are adjusted accordingly.”

I have set the timeout in the provider block to 600 seconds:

provider "genesyscloud" {
 timeout = 600
}

But it still fails. Is there a specific API endpoint I should be calling directly to debug this? Or is the CX as Code provider hitting a rate limit on the export batch jobs?

Also, the error message is generic. Is there a way to get more detailed logs from the genesys_cloud provider to see which resource is causing the 500 error?

We need a reliable way to export the config. The current method is not working for large orgs. Any ideas on how to force a full export or split it into chunks?

The docs also mention: “For very large organizations, consider exporting specific resource types rather than the entire organization.”

But how do I specify resource types in the export command? I don’t see a flag for that in the genesyscloud export command.

Is there a workaround?