Dealing with a very strange bug here with the genesyscloud_wfm_scheduling_group resource during state import. Trying to migrate a legacy WFM setup into Terraform state without destroying existing schedules.
Environment: Terraform v1.9.2, genesyscloud v1.62.0. Provider config uses OAuth client credentials flow. Instance region: ap-southeast-2.
The standard import command works for basic properties:
terraform import genesyscloud_wfm_scheduling_group.main <instance_id>:<scheduling_group_id>
However, the import fails immediately when the scheduling group references a custom constraint set that was created via API but not yet managed by IaC. The error log shows:
Error: Error importing object "<scheduling_group_id>": 404 Not Found
Details: Unable to fetch constraint set "custom_constraint_01" referenced by scheduling group.
API call trace shows the provider attempts to fetch the constraint set metadata before completing the scheduling group import. The constraint set exists and is active. Direct API call to GET /api/v2/wfm/scheduling/constraintsets/{id} returns 200 OK with valid JSON.
{
"id": "custom_constraint_01",
"name": "Peak Hours Constraint",
"status": "ACTIVE"
}
Suspect this is a race condition or a missing dependency resolution in the provider’s import logic for WFM resources. The genesyscloud_wfm_constraint_set resource exists but importing it first does not resolve the issue. The scheduling group import still throws 404.
Has anyone successfully imported scheduling groups with external constraint references? Workaround involves manually removing constraints, importing, then re-adding via API, but that breaks audit trails. Looking for a cleaner IaC migration path.