Skip to content
Snippets Groups Projects
Commit ed8760cc authored by nimrod's avatar nimrod
Browse files

Terraform shell functions and alias.

- Rename them to tf* instead of t* (tr is already taken, so avoid that).
- Don't use a variable file for the workspace if not variable file
exists.
parent c31c4a11
No related branches found
No related tags found
No related merge requests found
...@@ -121,7 +121,7 @@ alias check_unix='nc -Uvzw3' ...@@ -121,7 +121,7 @@ alias check_unix='nc -Uvzw3'
alias listen_tcp='nc -vlk 0.0.0.0' alias listen_tcp='nc -vlk 0.0.0.0'
alias listen_udp='nc -uvlk 0.0.0.0' alias listen_udp='nc -uvlk 0.0.0.0'
alias listen_unix='nc -Uvlk' alias listen_unix='nc -Uvlk'
alias ta='terraform apply tfplan' alias tfa='terraform apply tfplan'
if ! command -v notify-send > /dev/null if ! command -v notify-send > /dev/null
then then
...@@ -132,9 +132,9 @@ then ...@@ -132,9 +132,9 @@ then
alias notify-send="notify-send --hint \"string:desktop-entry:$(basename "$GIO_LAUNCHED_DESKTOP_FILE")\"" alias notify-send="notify-send --hint \"string:desktop-entry:$(basename "$GIO_LAUNCHED_DESKTOP_FILE")\""
fi fi
tp () { tfp () {
workspace="$(terraform workspace show)" workspace="$(terraform workspace show)"
if [ "$workspace" = "default" ] if [ "$workspace" = "default" ] || [ ! -f "$workspace.tfvars" ]
then then
terraform plan -out tfplan "$@" terraform plan -out tfplan "$@"
else else
...@@ -142,9 +142,9 @@ tp () { ...@@ -142,9 +142,9 @@ tp () {
fi fi
} }
taa () { tfaa () {
workspace="$(terraform workspace show)" workspace="$(terraform workspace show)"
if [ "$workspace" = "default" ] if [ "$workspace" = "default" ] || [ ! -f "$workspace.tfvars" ]
then then
terraform apply -auto-approve "$@" terraform apply -auto-approve "$@"
else else
...@@ -152,9 +152,9 @@ taa () { ...@@ -152,9 +152,9 @@ taa () {
fi fi
} }
tr () { tfr () {
workspace="$(terraform workspace show)" workspace="$(terraform workspace show)"
if [ "$workspace" = "default" ] if [ "$workspace" = "default" ] || [ ! -f "$workspace.tfvars" ]
then then
terraform refresh "$@" terraform refresh "$@"
else else
...@@ -162,9 +162,9 @@ tr () { ...@@ -162,9 +162,9 @@ tr () {
fi fi
} }
ti () { tfi () {
workspace="$(terraform workspace show)" workspace="$(terraform workspace show)"
if [ "$workspace" = "default" ] if [ "$workspace" = "default" ] || [ ! -f "$workspace.tfvars" ]
then then
terraform import "$@" terraform import "$@"
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment