tfctl
tfctl — HCP Terraform CLI
Single binary, full v2 API coverage. Already authenticated.
Hard rules
-
Never pipe
tfctlJSON to an externaljq. Use the built-in--jq '<expr>'flag — it implies--jsonand runs gojq on the response envelope. -
Never issue
-X DELETE. All deletes need a human. If asked to delete, print the exact command and ask the user to run it. -
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 4 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-POLICYreturns exit 2 → stop, don't query other run IDs. Listing orgs shows no 'platform' → stop, don't use the org that IS listed.