From aa5e3a56405c00dca7803b4571ed9c42d84e186e Mon Sep 17 00:00:00 2001 From: Gal Szkolnik Date: Fri, 5 Aug 2022 10:06:12 -0400 Subject: [PATCH] gcp stack output includes firewall --- _home/dot_sz.shrc.d/32_gcp.shortcuts | 3 +++ _home/dot_sz.shrc.d/33_terraform.shortcuts | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/_home/dot_sz.shrc.d/32_gcp.shortcuts b/_home/dot_sz.shrc.d/32_gcp.shortcuts index 216ce19..c7a288a 100644 --- a/_home/dot_sz.shrc.d/32_gcp.shortcuts +++ b/_home/dot_sz.shrc.d/32_gcp.shortcuts @@ -48,6 +48,9 @@ function gcp_get_stack() { '&& { gcloud compute networks subnets list --filter="name:$N" | ' "sed --unbuffered s/^/Subnets..:\ /g ; } " \ '&& { gcloud compute disks list --filter="name:$N" | ' "sed --unbuffered s/^/Disks....:\ /g ; } " \ '&& { gcloud compute instances list --filter="name:$N" | ' "sed --unbuffered s/^/Instances:\ /g ; } " \ + '&& { gcloud compute network-firewall-policies get-effective-firewalls --network="$N-network"' \ + " | sed --unbuffered s/^/Firewall:\ /g ; } " \ + ) ;}" [ $# -ge 2 ] && _cmd="watch -n${2} '${_cmd}'" [[ -n ${SZ_DEBUG} ]] && printf "Executing: \n\t$_cmd\n\n" diff --git a/_home/dot_sz.shrc.d/33_terraform.shortcuts b/_home/dot_sz.shrc.d/33_terraform.shortcuts index a1b3f8f..3054556 100644 --- a/_home/dot_sz.shrc.d/33_terraform.shortcuts +++ b/_home/dot_sz.shrc.d/33_terraform.shortcuts @@ -90,10 +90,14 @@ if [[ -x $TERRAFORM_BIN ]]; then echo "Could not find environment variables matching: $(echo "^TF_${PATTERN}")" } || { unset $TOCLEAR - echo "Cleared the following vars: $TOCLEAR" + echo "Cleared the following vars: $(echo "$TOCLEAR" | xargs echo)" } } + function get-tf-env-plan() { + set | grep '^TF\(_\(VAR_[a-z]\)\|\([A-Z_]TARGET=\)\)' | grep '\b=' + } + function clear-tf-env-vars() { clear-tf-env 'VAR_[a-z]' }