An HCP Terraform run has sat in Pending for an hour with no plan output: how do you find what is holding it and clear it safely?
answer
- one queue per workspace
- an earlier run waiting on a person
- manual lock versus run lock
- capacity across the organization
- what a pending run has already pinned
basics
~20 sCheck the workspace first: an earlier run paused for confirmation or a policy override holds the queue, as does a manual lock. If neither, check organization capacity. Clear the blocker through its owner; Force Cancel Run comes last.
solid answer
~50 sEach HCP Terraform workspace processes its own queue in order, and a pending run does not even plan until every earlier run has completed. So I open the workspace's run list. A common cause is an earlier run sitting in **Needs Confirmation** or **Policy Override**, waiting on a person; someone with permission to apply runs confirms or discards it. Next I check for a manual lock, which leaves new runs Pending until released; only the locker or a workspace admin can release it. If the CLI started the run, its wait message says which queue it is in. If neither applies, I look for a canceled run that failed to end, or organization-wide capacity. Force Cancel Run comes last, because it can lose state. A successful speculative plan proves nothing here, since plan-only runs skip both queue and lock.
go deeper
Recall that each HCP Terraform workspace runs one thing at a time, in order, and that Pending means waiting. Know a plan awaiting approval still counts as in progress.
Explain what counts as complete, why later runs are not planned early, and how a manual lock differs from the lock a run in progress holds. Name which runs skip both.
Show the order you would check and who can clear each blocker. Read the CLI's wait messages, avoid force-canceling first, and remember a pending run keeps its pinned configuration and variable values.
Treat recurring queue stalls as a design signal: workspaces shared by too many teams, approval habits nobody owns, or concurrency too low for the estate. Decide on auto-apply policy and notifications rather than chasing single runs.
## Why a run sits in Pending In HCP Terraform, **Pending** means the service has not started action on the run yet. A run stays there until every run before it in that workspace has completed. HCP Terraform deliberately does not plan it early, because the current run might change what a later run would do. **Completion** is the word to read carefully. A run is complete when it finishes applying, when part of it fails, when there is nothing to do, or when a user chooses not to continue. A run paused for a human has not completed. That is why a plan someone opened and walked away from can block a workspace all afternoon, with nothing visibly happening. ## Work through the causes in order 1. **An earlier run paused on a person.** Look for **Needs Confirmation**, **Policy Override** or a paused **Policy Checked**. Read what that plan would do, then have someone with permission to apply runs use **Confirm & Apply** or **Discard Run**. 2. **A manual workspace lock.** The lock status appears in the workspace header. New runs stay Pending until it is released. This is separate from the lock a run in progress holds: you cannot place a manual lock while a run holds one. 3. **A cancel that did not finish.** In rare cases a canceled run fails to end and keeps the workspace locked. **Force Cancel Run** exists for this. 4. **Organization-wide capacity.** Workers take jobs from a global queue, and your edition limits run concurrency. If several workspaces are waiting, this is the likely cause. ## Let the CLI tell you A run started from the terminal reports where it is waiting, about every 30 seconds: | Message | Meaning | |---|---| | `Waiting for the manually locked workspace to be unlocked...` | The workspace is locked and its current run is still pending | | `Waiting for N run(s) to finish before being queued...` | Earlier runs in this workspace's own queue | | `Waiting for N queued run(s) to finish before starting...` | The run is in the organization's queue, waiting on capacity | The first two are workspace problems you can fix with the right permission. The third is a capacity question. ## Who can clear what | Blocker | Action | Needs | |---|---|---| | Run awaiting confirmation | Confirm & Apply, or Discard Run | Permission to apply runs | | Failed soft-mandatory policy | Override & Continue | Permission to manage policy overrides | | Own manual lock | Unlock | Lock/unlock workspace | | Someone else's lock | Force unlock | Admin access to the workspace | | Stuck canceled run | Force Cancel Run | Admin access to the workspace | Force-canceling immediately terminates the Terraform process and unlocks the workspace. It **can cause loss of state and orphaned resources**, so the button only appears after **Cancel Run** has had time to end the run safely. Treat it as the last step and check state afterwards. ## Three traps while diagnosing - **A green speculative plan proves nothing about the queue.** Plan-only runs, and the planning stage of saved plan runs, ignore both the queue and workspace locks. A colleague's successful `terraform plan` from a laptop does not mean applies can proceed. - **Your fix does not reach the stuck run.** A run is locked to its configuration version and variable values when initiated. If the pending run has a wrong variable or a bad commit, correcting it only affects future runs, so discard that run and queue another. - **Global queue order is not first come, first served.** When the global queue is backed up, applying approved plans has the highest priority, then normal plans, and speculative plans last. ## Making it rarer - Turn on **auto-apply** where a workspace's risk allows it. Plans queued by users without permission to apply still need approval, and CLI runs use `-auto-approve` instead. - Configure run notifications, which send webhooks to external services on run events, so a paused run reaches a person rather than waiting to be noticed. - Split a workspace that many teams share. One queue per workspace means one person's pause blocks everyone in it.
- A colleague's `terraform plan` works in that HCP Terraform workspace while applies wait. Why?In a CLI-integrated workspace, `terraform plan` starts a speculative plan, a plan-only run. Those proceed at any time, ignore workspace locks and do not block other runs, because they cannot affect infrastructure. So it tells you the configuration and credentials work, not that the queue is free.
- When several HCP Terraform workspaces are waiting at once, which jobs go first?Workers take jobs from a global queue, and when it is backed up, applying approved plans has the highest priority, then creating normal plans, then speculative plans. The edition limits your organization's concurrency, and HCP Terraform may also delay some jobs when an organization requests many at once.
- Why not click Force Cancel Run straight away?It immediately terminates the Terraform process, which can cause loss of state and orphaned resources. A normal cancel sends an interrupt so Terraform can update state for changes already made and wrap up safely. The force button needs workspace admin access and only appears after Cancel Run has had time to work.
A workspace's run queue is a single-lane toll road. A car stopped at the booth waiting for someone to wave it through holds every car behind it, even though nothing is moving. A plan-only run is someone walking along the verge to look at the road: they get past, but that says nothing about the lane.
- A Pending run means HCP Terraform's workers must be down.
- A successful plan-only run proves the workspace's run queue is healthy.
- Force Cancel Run is the first thing to try on a stuck workspace.
- Committing a fix updates the configuration of the run already pending.
- A run waiting in Needs Confirmation has finished, so it cannot block the next one.
- Anyone with the lock permission can remove a colleague's workspace lock.