Problem
When attempting to start a new run in an HCP Terraform workspace, the operation may fail with the following error message, indicating the workspace is locked:
Error unlocking workspace: Locked by a run that is not discardable
This issue typically occurs when a previous run was canceled or failed in a way that did not properly release the workspace lock, which prevents new runs from starting.
Prerequisites
- You need permissions to manage workspace settings for the locked workspace.
Procedure
To resolve this issue, you must manually force the unlock of the workspace by following these steps.
- Navigate to the locked workspace in your HCP Terraform organization.
- Select the Settings tab from the workspace menu.
- From the navigation menu on the left, select Locking.
- Click the red Force Unlock button to manually release the lock. You may be required to type the workspace name to confirm this action.
Outcome
After you force the unlock, the workspace lock is released, and you can trigger new runs successfully.