Terraform state lock error on genesyscloud_routing_queue drift detection

Why is the Terraform provider hanging on a state lock when I run terraform plan for a simple queue update?

I’ve been managing our CXone instance config with the Nice CXone Terraform provider. It’s usually fine, but now I’m hitting a wall. I just changed the outbound_caller_id on a genesyscloud_routing_queue resource. Nothing fancy. But when I run the plan, it hangs for about 20 seconds and then throws this:

Error: Error acquiring the state lock

Lock Info:
 ID: 8f3a9c2e-1b2d-4f5a-9c8e-7d6b5a4f3e2d
 Path: tfstate
 Operation: OperationTypePlan
 Who: my-laptop@192.168.1.5
 Version: 1.0
 Created: 2023-10-27 14:30:00.000000 +0000 UTC
 Info: 

"terraform force-unlock" is my only option?

The weird part is no one else is running Terraform. I checked the backend logs. No active runs. I even tried terraform refresh and same thing. The state file seems corrupted or the lock isn’t releasing properly after a failed API call to /api/v2/routing/queues.

Is there a way to debug the lock acquisition without nuking the state file? I’m worried about drift if I force it. The SDK calls seem fine in Postman, so the API isn’t down. Just stuck here.

Are you running this from a CI/CD pipeline or just locally? The state lock issue usually happens when another process holds the lock, but with the CXone provider, it can also be a timeout waiting for the backend API to settle after a drift check.

If it’s just a hang, try increasing the timeout in your provider block. The default is sometimes too short for larger instances.

provider "nice_cxone" {
 environment = "US"
 timeout = 60 # seconds
}

Also, check if you have any active flows or integrations tied to that queue. If the provider tries to update a queue that’s in use, it might block the state file while waiting for the API to return a conflict or success. Be careful not to force unlock the state unless you’re absolutely sure no other plan is running, because that can corrupt your infrastructure map. I’ve seen it happen. Just wait it out or kill the hanging process manually if it’s stuck in a loop.