Aligned all section and script names.
Co-authored-by: jmhbnz <mail@jamesblair.net>
This commit is contained in:
25
6-teardown-cloud-resources.sh
Executable file
25
6-teardown-cloud-resources.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
# Step 6 - Teardown cloud resources
|
||||
|
||||
# The Google Cloud Platform resources created by this process come at a cost, so it's important we have an easy way to teardown those resources as soon as we're finished with them!
|
||||
|
||||
# The script below will delete any projects containing ~gitlab~ in the name along with any compute instances running in those projects.
|
||||
|
||||
# Tangle the shell block below to a shell script by pressing *, b t* in emacs command mode:
|
||||
|
||||
|
||||
# Iterate over any matching projects
|
||||
for project in $(gcloud projects list | awk '{ print $1 }' | grep gitlab); do
|
||||
|
||||
# Iterate over any instances in the project
|
||||
for instance in $(gcloud compute instances list --project $project --format="value(name)"); do
|
||||
|
||||
# Delete the instance
|
||||
gcloud compute instances delete --quiet $instance --zone australia-southeast1-a --project $project
|
||||
|
||||
done
|
||||
|
||||
# Delete the project as well
|
||||
gcloud projects delete $project --quiet
|
||||
|
||||
done
|
||||
Reference in New Issue
Block a user