- CLEARED
- UNLOCKED
- CLEANUP
- HUMAN
Short answer
How do I fix a stuck Terraform Cloud run using AI?
Tell your AI to find the problematic workspace and cancel the specific run or force an unlock. You'll get a clear path to restoring your deployment flow.
Where every issue lands.
Resolution outcomes
The AI sorts your troubleshooting into these specific results.
CLEARED
Run is canceled
The AI stops a specific execution that is hanging or misbehaving. This frees up your pipeline immediately.
UNLOCKED
Workspace is free
The AI removes stale locks that prevent new runs. You can start fresh without manual intervention.
CLEANUP
Run is discarded
The AI wipes out a failed or unnecessary run. This keeps your run history clean and organized.
HUMAN
Manual review needed
The AI identifies the stuck run but leaves the final architectural decision to you. You decide if a force unlock is safe for your state.
The workflow
What your AI does when a run hangs.
Your AI acts as a bridge between your chat interface and the Terraform Cloud API.
Locate the problem
The AI scans your environment to find exactly which workspaces are currently active or locked.
list_workspacesStop the execution
Once the problematic run is identified, the AI kills the specific process to stop it from consuming resources.
cancel_runClear the lock
If a workspace is stuck in a locked state, the AI breaks the lock so you can run again.
force_unlock_workspaceRemove failed runs
The AI cleans up the run history by removing specific problematic entries.
discard_run
Try it
Copy these to start.
Use these prompts to trigger actions in Terraform Cloud.
Starting points
Swap out the workspace names and run IDs with your actual Terraform Cloud data.
Terraform Cloud (HCP) Connector
You're all set. Choose your MCP client and follow the setup instructions.
https://edge.vinkius.com/vk_preview_pNVIE7JDmTNH9R3AT9KWNrBlFpc8rqVEBmhZ8zXB/mcpClaude Desktop
Follow the steps below to connect in seconds.
- 1In Claude Desktop, open Settings → Connectors.
- 2Click “Add custom connector” and paste the connector link above as the remote MCP server URL.
- 3Click Add and start a new chat — Terraform Cloud (HCP) capabilities are ready to use.
{
"mcpServers": {
"terraform-cloud-hcp-mcp": {
"url": "https://edge.vinkius.com/vk_preview_pNVIE7JDmTNH9R3AT9KWNrBlFpc8rqVEBmhZ8zXB/mcp"
}
}
}List all my workspaces so I can find the one that is stuck.
Cancel the current run in the production workspace.
Force unlock the workspace named 'app-infra-prod' because it's stuck.
Discard the last failed run in my staging workspace.
Claude
ChatGPT
Cursor
VS Code
Windsurf
Claude Code
JetBrains
Cline
Start here
Connect Terraform Cloud (HCP) once, then ask.
One connection gives your AI access to your workspaces. Your credentials stay encrypted and secure.
Connect Terraform Cloud (HCP) to your AIFAQ
How this task behaves
- 01
Can the AI delete my entire infrastructure?
No. The AI only has tools to manage runs and workspace locks. It cannot delete workspaces or resources.
- 02
Will the AI automatically force unlock every workspace?
No. The AI only performs a force unlock when you specifically instruct it to do so.
- 03
Can the AI see my Terraform state files?
No. The AI can only interact with the run and workspace management tools provided in the manifest.
- 04
How does the AI know which run to cancel?
You must identify the run or workspace in your prompt, or ask the AI to list workspaces first to find it.
- 05
Does the AI handle the actual Terraform apply logic?
No. The AI manages the lifecycle of the runs, such as canceling or discarding them, but it doesn't write or execute HCL code.
More questions about Terraform Cloud (HCP)? The Connector page answers them. See everything the Terraform Cloud (HCP) Connector can do
Connect Terraform Cloud (HCP) to Claude, Cursor, ChatGPT & more
