terraform.plugin.zsh 706 B

1234567891011121314151617181920212223
  1. function tf_prompt_info() {
  2. # dont show 'default' workspace in home dir
  3. [[ "$PWD" != ~ ]] || return
  4. # check if in terraform dir and file exists
  5. [[ -d .terraform && -r .terraform/environment ]] || return
  6. local workspace="$(< .terraform/environment)"
  7. echo "${ZSH_THEME_TF_PROMPT_PREFIX-[}${workspace:gs/%/%%}${ZSH_THEME_TF_PROMPT_SUFFIX-]}"
  8. }
  9. alias tf='terraform'
  10. alias tfa='terraform apply'
  11. alias tfd='terraform destroy'
  12. alias tff='terraform fmt'
  13. alias tfi='terraform init'
  14. alias tfo='terraform output'
  15. alias tfp='terraform plan'
  16. alias tfv='terraform validate'
  17. if (( $+commands[terraform] )); then
  18. autoload -U +X bashcompinit && bashcompinit
  19. complete -o nospace -C terraform terraform
  20. fi