mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-06-16 11:36:16 +08:00
Add aliases for frequently used terraform commands that were missing: - tffck: terraform fmt -check -recursive (CI formatting check) - tfg: terraform graph (visualize resource graph) - tfib: terraform init -backend=false (init without backend) - tfip: terraform import (import existing infrastructure) - tfpo: terraform plan -out tfplan (save plan to file) - tfpr: terraform providers (list provider dependencies) - tfr: terraform refresh (refresh state) - tfsr: terraform state rm (remove from state) - tfwn: terraform workspace new (create workspace) Also sort aliases alphabetically and update README.
2.7 KiB
2.7 KiB
Terraform plugin
Plugin for Terraform, a tool from Hashicorp for managing infrastructure safely and efficiently. It adds
completion for terraform, as well as aliases and a prompt function.
To use it, add terraform to the plugins array of your ~/.zshrc file:
plugins=(... terraform)
Requirements
Aliases
| Alias | Command |
|---|---|
tf |
terraform |
tfa |
terraform apply |
tfa! |
terraform apply -auto-approve |
tfap |
terraform apply -parallelism=1 |
tfc |
terraform console |
tfd |
terraform destroy |
tfd! |
terraform destroy -auto-approve |
tfdp |
terraform destroy -parallelism=1 |
tff |
terraform fmt |
tffr |
terraform fmt -recursive |
tffck |
terraform fmt -check -recursive |
tfg |
terraform graph |
tfi |
terraform init |
tfib |
terraform init -backend=false |
tfir |
terraform init -reconfigure |
tfiu |
terraform init -upgrade |
tfiur |
terraform init -upgrade -reconfigure |
tfip |
terraform import |
tfo |
terraform output |
tfp |
terraform plan |
tfpo |
terraform plan -out tfplan |
tfpr |
terraform providers |
tfr |
terraform refresh |
tfs |
terraform state |
tfsr |
terraform state rm |
tft |
terraform test |
tfsh |
terraform show |
tfv |
terraform validate |
tfw |
terraform workspace |
tfwl |
terraform workspace list |
tfwn |
terraform workspace new |
tfws |
terraform workspace select |
Prompt function
You can add the current Terraform workspace in your prompt by adding $(tf_prompt_info),
$(tf_version_prompt_info) to your PROMPT or RPROMPT variable.
RPROMPT='$(tf_prompt_info)'
RPROMPT='$(tf_version_prompt_info)'
You can also specify the PREFIX and SUFFIX for the workspace with the following variables:
ZSH_THEME_TF_PROMPT_PREFIX="%{$fg[white]%}"
ZSH_THEME_TF_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_TF_VERSION_PROMPT_PREFIX="%{$fg[white]%}"
ZSH_THEME_TF_VERSION_PROMPT_SUFFIX="%{$reset_color%}"