From f066698b431d42c09e2775f0aae0326c9cb8d1eb Mon Sep 17 00:00:00 2001 From: Lars Gohlke Date: Thu, 15 Feb 2024 17:48:58 +0100 Subject: [PATCH] adds search to tf_state_show --- tools/terraform.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/terraform.sh b/tools/terraform.sh index 728e0ea..6fb32b3 100644 --- a/tools/terraform.sh +++ b/tools/terraform.sh @@ -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 { @@ -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