Problem
Runs in HCP Terraform have completed the apply stage but remain in the "Applying" state in the user interface. The raw log for the run does not show any new output, and the run appears to be stuck.
Prerequisites
- This issue may affect environments using HCP Terraform self-hosted agents version 1.7.0 and earlier.
Cause
This issue can occur when HCP Terraform fails to correctly transition the run's status after the apply job has finished, often due to a communication issue or an error in the final status update.
Solutions
Solution 1: Force Cancel the Run
To resolve a stuck run, you can manually trigger a force cancel.
- Navigate to the stuck run in the HCP Terraform UI.
- Click the Cancel button.
- Wait for 30 seconds. If the run does not cancel within this period, the status will automatically transition to Force Canceled.
Outcome
The run transitions to a Force Canceled state, which unblocks the workspace and allows you to queue new runs.