Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
Created February 22, 2022 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkuchiki/2d830352a8bf2dbf1ed671e7abbcf38d to your computer and use it in GitHub Desktop.
Save tkuchiki/2d830352a8bf2dbf1ed671e7abbcf38d to your computer and use it in GitHub Desktop.
#!/bin/bash
project="${1}"
instance="${2}"
billing_project="${3}"
_gcloud() {
if [ "${billing_project}" != "" ]; then
gcloud --project ${project} --billing-project ${billing_project} "${@}"
fi
gcloud --project ${project} "${@}"
}
for db in $(_gcloud spanner databases list --instance=${instance} | awk '{print $1}'); do
_gcloud spanner databases delete --instance=${instance} ${db}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment