Terraform 409 Conflict on genesyscloud_auth_division despite existing resource

I’m trying to manage our WFM divisions via Terraform to keep our adherence reporting scopes consistent. I have a script that runs terraform apply every night to sync our org structure.

Last night it failed with a 409 Conflict on the genesyscloud_auth_division resource. The error says the division already exists. This is strange because the state file shows it as managed. I checked the Genesys UI and the division is there. It seems like the provider can’t find the resource by ID or name properly during the plan phase, or maybe there is a race condition with the default division logic.

Here is the resource block:

resource "genesyscloud_auth_division" "wfm_reporting" {
 name = "WFM Reporting Division"
 description = "Division for WFM adherence and schedule data"
}

The error output is:

Error: Conflict. Division already exists.
 with genesyscloud_auth_division.wfm_reporting,
 on main.tf line 12, in resource "genesyscloud_auth_division" "wfm_reporting":
 12: resource "genesyscloud_auth_division" "wfm_reporting" {

I tried running terraform refresh but it didn’t update the state. The state file still has the old ID. I checked the API docs for /api/v2/auth/divisions and it looks like we should be able to fetch by name, but the provider seems to be trying to create a new one instead of importing or updating.

Is there a way to force the provider to look up the existing division by name before attempting creation? Or do I need to manually import the state? I don’t want to delete the division because it breaks the historical adherence data links.

We’re using provider version 1.12.0.

Any ideas on how to fix this idempotency issue?

that 409 is usually the provider’s way of saying “I know it exists, but I can’t link my ID to it.” The Genesys Cloud Terraform provider is notoriously finicky with divisions because they’re often pre-provisioned or created outside the IaC scope. If the state file doesn’t have the actual Genesys Cloud ID for that division, every apply tries to create it again, hits the existing resource, and bombs with a 409.

You don’t need to delete the division in the UI. You just need to import it into your Terraform state so the provider knows it’s already managed. Run this in your terminal:

terraform import genesyscloud_auth_division.wfm_reporting <GENESYS_CLOUD_DIVISION_ID>

You can find that ID by hitting the API directly if it’s not obvious in the URL.

curl -X GET "https://api.mypurecloud.com/api/v2/auth/divisions" \
 -H "Authorization: Bearer <YOUR_ACCESS_TOKEN>" \
 -H "Accept: application/json"

Look for the division matching your name, grab the id field, and plug it into the import command. Once that’s done, run terraform plan. It should show no changes. If it still complains about drift, check your genesyscloud_auth_division block in the .tf file. Make sure the name and description match exactly what’s in Genesys Cloud. Case sensitivity matters here.

Also, double-check that you’re not accidentally trying to create a division with the same name in another module. Terraform doesn’t care if it’s in a different file, just that the state knows about it.

If you’re still stuck, dump the output of terraform state show genesyscloud_auth_division.wfm_reporting (after the import) and compare it to the API response. Sometimes the provider expects a divisions attribute that isn’t documented well.