=Streamlined gcp/terraform helpers

This commit is contained in:
Gal Szkolnik 2022-08-02 07:27:25 -04:00
parent b18c977d75
commit bd4bc1b7ee
3 changed files with 9 additions and 8 deletions
_home/dot_sz.shrc.d

View file

@ -35,10 +35,10 @@ function gcp_get_stack() {
local N="${1:-$(basename $PWD)}"
local _cmd="{ $(printf "%s " \
"N='$N'; CLOUDSDK_ACTIVE_CONFIG_NAME=dust-personal; echo 'Listing $N stack:'; " \
'{ gcloud compute instances list --filter="name:$N" | ' "sed s/^/Instances:\ /g ; } " \
'&& { gcloud compute networks list --filter="name:$N" | ' "sed s/^/Networks.:\ /g ; } " \
'{ gcloud compute networks list --filter="name:$N" | ' "sed s/^/Networks.:\ /g ; } " \
'&& { gcloud compute networks subnets list --filter="name:$N" | ' "sed s/^/Subnets..:\ /g ; } " \
'&& { gcloud compute disks list --filter="name:$N" | ' "sed s/^/Disks....:\ /g ; } " \
'&& { gcloud compute instances list --filter="name:$N" | ' "sed s/^/Instances:\ /g ; } " \
) ;}"
[ $# -ge 2 ] && _cmd="watch -n${2} '$_cmd'"
[[ -n ${SZ_DEBUG} ]] && printf "Executing: \n\t$_cmd\n\n"