forked from oracle-devrel/oracle-autonomous-database-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete-all-resources.sh
executable file
·34 lines (26 loc) · 1.03 KB
/
delete-all-resources.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Copyright (c) 2025 Oracle and/or its affiliates.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
# ensure you update the config file to match your deployment prior to running the deployment
source ./config
# Ask for confirmation
echo ""
echo "Are you sure you want to delete the sample resources?"
echo "- ADB: $ADB_NAME"
echo "- Bucket: $BUCKET_NAME"
echo "- VM: $VM_NAME"
echo ""
echo "Enter (y/n)"
read confirmation
if [[ $confirmation == [yY] || $confirmation == [yY][eE][sS] ]]; then
echo "Deleting Autonomous Database"
gcloud oracle-database autonomous-databases delete $ADB_NAME --location=$REGION --quiet
echo "Deleting storage bucket $BUCKET_NAME"
gcloud storage rm -r gs://$BUCKET_NAME/*
gcloud storage buckets delete gs://$BUCKET_NAME
echo "Deleting VM"
gcloud compute instances delete $VM_NAME --zone $REGION-a
echo "The network has not been deleted. You can do that using the console.".
else
echo "Deletion cancelled."
fi