WFM Schedule Group 409 Conflict During IaC Deployment

Looking for advice on handling a persistent 409 Conflict error during Terraform apply.

Environment:

  • Terraform 1.6.5
  • Genesys Cloud Provider 1.28.0
  • Region: AP Southeast

The pipeline fails at genesyscloud_wfm_schedule_group. The resource exists in the org, but Terraform insists on creating it again, resulting in a conflict on the name attribute.

resource "genesyscloud_wfm_schedule_group" "qa_group" {
 name = "QA_Team_Schedule"
 description = "Automated QA Scheduling"
 
 schedule {
 name = "Standard_Hours"
 start_time = "09:00:00"
 end_time = "17:00:00"
 }
}

Drift detection shows no difference. The API returns a 409 with message Resource already exists. Manual import via terraform import succeeds, but subsequent applies fail with the same 409.

Is this a known issue with the provider’s conflict resolution logic for WFM resources? Or is there a specific API flag required to force an update instead of a create?

Logs show the POST request hitting /api/v2/wfm/schedulegroups without the expected If-None-Match header handling. Need a workaround to stabilize the CI/CD pipeline.

The problem here is the inherent conflict between Terraform’s state management and Genesys Cloud’s immutable resource constraints for WFM Schedule Groups. The provider often struggles to reconcile existing resources when the name matches but other attributes diverge slightly, leading to a failed create attempt instead of an update.

A more robust approach involves explicitly handling the import process. Before running terraform apply, use terraform import to pull the existing Schedule Group into the state file. This ensures Terraform tracks the resource as an update rather than a creation.

Ensure the payload structure matches the API expectations exactly. Minor deviations in nested objects can trigger this 409. Here is the corrected structure for the schedule group definition:

{
 "name": "Sales Team Schedule",
 "divisionId": "12345",
 "type": "WEEKLY",
 "weeklySchedule": {
 "monday": { "startTime": "09:00", "endTime": "17:00" }
 }
}

Verify the divisionId is correct. Mismatched divisions often cause silent failures that manifest as conflicts later.