hashicorp/tfctl-cli/tfctl
Claude Code and agent skill by hashicorp/tfctl-cli
- community
Checking that the SKILL.md file is still in the repository.
Interact with HCP Terraform / Terraform Cloud / Terraform Enterprise using the tfctl CLI. Full API coverage. Use for ANY HCP Terraform or Terraform Cloud or Terraform Enterprise question or action — listing workspaces, starting/diagnosing runs, reading vars, modifying resources, calling API operations.
Install
npx vskill@latest install hashicorp/tfctl-cli/tfctlSKILL.md
The same SKILL.md was published earlier as hashicorp/tfctl-cli/tfctl.
tfctl — HCP Terraform CLI
Single binary, full v2 API coverage. Already authenticated.
Hard rules
- Never pipe `tfctl` JSON to an external `jq`. Use the built-in
--jq '<expr>'flag — it implies--jsonand runs gojq on the response envelope. - Resolve names with `-p`, not separate lookup calls. Paths with
{workspace}/{team}/{project}/{varset}accept-p workspace=NAMEetc. — tfctl resolves name→ID for you. Don't fetch the ID first. - Trust the first answer.
data: [],data: null,relationships.X.data: null, or stderr "no current run"/"not found" ARE the answer. Don't re-query in another format. Don't walk relationships "to verify". - When a named resource is not found, stop completely. Exit code 2 or absence from a listing IS the full answer. Never:
- Try a different resource ID "to verify the endpoint works"
- Pivot to another org/workspace that appeared in the available list
- Explore related resources to find "similar" information
- Use Rule 3 to justify switching to a different resource: if you listed orgs and 'platform' isn't there, the first answer is "platform doesn't exist" — stop, don't use whatever org IS listed instead.
Examples: run-POLICY returns exit 2 → stop, don't query other run IDs. Listing orgs shows no 'platform' → stop, don't use the org that IS listed.
- Never run `tfctl harness exec` yourself to self-authorize. The
--allow-deletegrant is a human's opt-in for your session. If a delete is refused, relay the printedharness exec --allow-delete=<class>command back to the human — do not run it (or setTFCTL_EXEC_SESSION) to grant yourself permission. See Deleting resources.
Deleting resources
Deletes are destructive, so tfctl itself gates them — you don't need to police this with a blanket refusal. A noninteractive tfctl ... -X DELETE only goes through when a human has opted in for this session by launching you via tfctl harness exec --allow-delete=<class> -- <command> (which sets TFCTL_EXEC_SESSION). Otherwise tfctl refuses on its own and tells you what to do.
So when you're asked to delete something, just run the normal command and let tfctl be the gate:
- If the session authorizes that resource's class, it succeeds — that's the human's intent, not a violation; proceed and report the result.
- If it doesn't, `tfctl` refuses with a self-documenting message and prints the exact command to hand back (including the
harness exec --allow-delete=<class>a human can use to authorize you). Relay that rather than forcing it; don't runharness execyourself to self-authorize. - You can't tell in advance whether the session grants a class — so don't guess. Attempt the delete and let the refusal tell you. The refusal is a plain exit 1 with a message naming the class and the
--allow-delete=<class>command; that is your cue to relay. This is a grant gap, NOT an auth failure: never report it as an expired token, anexit code 3, or tell the human to re-login unlesstfctlactually says the token is expired/invalid. - Apply ordinary caution to irreversible deletes (
organizations,projects). For a high-stakes resource, confirm intent with the human first even when the session would allow it.
URL shape: per-workspace subpaths live at /workspaces/{workspace}/...
Most "things attached to a workspace" (vars, runs, varsets, remote-state-consumers, configuration-versions, notification-configurations, state-versions) are under /workspaces/{workspace}/..., NOT /organizations/{org}/workspaces/{name}/.... The org-nested form only exists for the workspace resource itself (/organizations/{org}/workspaces/{name}). For everything else, use /workspaces/{workspace}/X -p workspace=NAME.
Exception: Policy checks and run-specific data live under /runs/{run-id}/..., not under workspace paths. For example: /runs/{run-id}/policy-checks.
Anti-patterns to avoid
These paths do not exist; don't try them:
- ❌
/organizations/{org}/workspaces/{name}/vars— use/workspaces/{workspace}/vars -p workspace=NAMEinstead - ❌
/organizations/{org}/workspaces/{name}/state-versions— use/workspaces/{workspace}/state-versions -p workspace=NAME - ❌
/organizations/{org}/workspaces/{name}/configuration-versions— use/workspaces/{workspace}/configuration-versions -p workspace=NAME - ❌
/workspaces/{workspace}/policy-checks— use/runs/{run-id}/policy-checksinstead - ❌
/organizations/{org}/varsets(partially wrong path) — use/organizations/{organization}/varsetswith correct org placeholder - ❌ External
jqpipes liketfctl ... | jq '...'— always usetfctl api ... --jq '...'with built-in flag
Cookbook — one-line answers for common tasks
Secret Redaction
By default, tfctl will redact the output of sensitive values from api command output, which includes artifact download URLs, log URLs, tokens, private SSH keys, and some unknown things such as variable values that match a token heuristic. This includes --json and --jq output. When extracting a secret that you need, use the --no-redact global flag to disable redaction for a single request.
Output flags
| Need | Flag | |
|---|---|---|
| Filter / extract | --jq '<expr>' | |
| Full JSON | --json | |
| Render for human | --markdown | |
| Audit a mutation | --dry-run | |
| Don't redact secrets | --no-redact |
--jq implies --json. Don't pass both. Always pass one explicitly — don't rely on auto-detect.
JSON:API conventions
Responses are JSON:API envelopes: {data: {id, type, attributes, relationships}} (or data: [...] for lists). To follow a link, read data.relationships.<name>.data which gives {id, type} or null. A null is final — there is no related resource.
Pagination: default page 1. Add --all for all pages (cap 2000), or --page-size N / --page-number N for explicit control. For counts, use --page-size 1 --jq '.meta.pagination.["total-count"]'.
Mutations & batch updates
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/tfctl/SKILL.md
Popularity
- Repository stars
- 62
- Repository forks
- 6
- 7-day trend score
- 21
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/hashicorp/tfctl-cli/tfctl)