terraform
Two-letter-ish aliases for the whole Terraform lifecycle, completion, and a
tf_prompt_info function that shows the active workspace in the prompt.
| Alias | Runs |
|---|---|
tf | terraform |
tfi / tfiu | init / init -upgrade |
tfp / tfpo | plan / plan -out tfplan |
tfa / tfapp | apply / apply tfplan |
tfa! / tfd! | apply / destroy with -auto-approve |
tff / tffr | fmt / fmt -recursive |
tfwl / tfws | workspace list / select |
Pro tips
- The plan-file loop is the safe default:
tfpowritestfplan, review it,tfappapplies exactly that plan — no drift between what you read and what runs. Savetfa!for throwaway sandboxes. - Workspace awareness is free:
tf_prompt_inforeads.terraform/environmentand shows[workspace]in the prompt (hidden fordefaultin$HOME). For occasional infra work, that's the guard against applying to the wrong workspace after weeks away — glance beforetfa. tfwlthentfws <name>is the two-command re-orientation when returning to a repo cold.- Provider/backend errors after a
git pull?tfiu(init -upgrade) fixes most of them;tfir(init -reconfigure) handles backend config changes. tffrbefore committing keeps.tfdiffs about substance, not whitespace — it recurses into modules, unlike plaintff.