forked from oracle-devrel/oracle-autonomous-database-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete-all-resources.sh
More file actions
executable file
·33 lines (28 loc) · 1.21 KB
/
delete-all-resources.sh
File metadata and controls
executable file
·33 lines (28 loc) · 1.21 KB
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
#!/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 "You are connected to:"
echo ""
az account show --query "{Name:name, TenantName:tenantDisplayName}" --output table
echo ""
echo "Are you sure you want to delete the resource group '$RESOURCE_GROUP'? All resources in that group WILL BE DELETED. This action cannot be undone."
echo "Enter (y/n)"
read confirmation
if [[ $confirmation == [yY] || $confirmation == [yY][eE][sS] ]]; then
echo "Deleting Autonomous Database"
az oracle-database autonomous-database delete --name $ADB_NAME --resource-group $RESOURCE_GROUP
if [ $? -eq 0 ]; then
echo "Database '$ADB_NAME' has been successfully deleted."
fi
echo "Deleting resource group '$RESOURCE_GROUP'..."
az group delete --name "$RESOURCE_GROUP" --yes
if [ $? -eq 0 ]; then
echo "Resource group '$RESOURCE_GROUP' has been successfully deleted."
fi
else
echo "Deletion cancelled. The resource group was not deleted."
fi