Skip to content

Commit

Permalink
adds search to tf_state_show
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars Gohlke committed Feb 15, 2024
1 parent 2ccc3e0 commit f066698
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tools/terraform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@ alias tf_init='terraform init'
alias tf_output='terraform output'
alias tf_providers='terraform providers'

# this fixes the output of ansi colors
# see https://github.com/hashicorp/terraform/issues/21779
alias tf_state_show='terraform state show -no-color'
alias tf_state_ls='terraform state list'
alias tf_state_mv='terraform state mv'
alias tf_state_rm='terraform state rm'
alias tf_taint='terraform taint'
alias tf_validate='terraform validate'



# terraform apply -auto-approve ...
# catches missing 'terraform init'
function tf_apply {
Expand Down Expand Up @@ -178,6 +177,14 @@ tf_graph() {
open "${image}.png"
}

function tf_state_show {
if [ "$*" == "" ]; then
tf_state_show $(gum spin --title "listing ... " --show-output terraform state list | gum filter)
else
terraform state show $* | tee >(to_clipboard)
fi
}

function tf_test {
if [[ ! -d tests ]]; then
read -r -p "Want to create a tests directory? (y/n) : " -n 1 reply
Expand Down

0 comments on commit f066698

Please sign in to comment.