Genesyscloud_wfm_scheduling_group import failing with 404 on custom constraint sets

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.

TL;DR: Verify the constraint set UUIDs exist in the target region before importing.

Make sure you verify that the custom constraint sets referenced in the scheduling group actually exist in the ap-southeast-2 environment. The 404 error typically indicates the provider cannot locate the dependent resources during the import handshake. This often happens when migrating configurations across regions where resource IDs do not align. Check the WFM Admin UI or use the REST API to confirm the constraint set UUIDs are valid in the target instance. If they are missing, create them first and note their IDs. Then update the Terraform configuration to reference these new IDs before retrying the import command. The provider requires all referenced entities to be present and accessible via the OAuth credentials used in the configuration. Ensuring data integrity for dependent objects prevents state drift and import failures.