Created
December 11, 2019 15:44
-
-
Save medwig/d7fb499eb84964523c871a560438c6b9 to your computer and use it in GitHub Desktop.
Terraform echo workspace before running apply or output command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run tf with echo tf-workspace | |
tf_with_tf_workspace() { | |
if [[ "$@" == "apply" ]] || [[ "$@" == "output" ]]; | |
then | |
\terraform workspace list; | |
fi | |
\terraform "$@"; | |
} | |
alias tf="terraform" | |
alias terraform="tf_with_tf_workspace" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add these lines to
~/.bashrc
(or~/.zshrc
). It also creates the shortertf
alias to runterraform