-
Notifications
You must be signed in to change notification settings - Fork 69
/
destroy.sh
executable file
·51 lines (33 loc) · 1.24 KB
/
destroy.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
set -e
gum style \
--foreground 212 --border-foreground 212 --border normal --margin "1 2" --padding "1 2" \
'Destroy Kubernetes clusters in DigitalOcean with Pulumi'
echo "
# This script will destroy a Kubernetes cluster in DigitalOcean using Pulumi
## Prerequisites
You will need following tool installed:
| Name | Required | More info |
|------------|----------|-----------------------------------------------------|
| Pulumi CLI | Yes | \`https://www.pulumi.com/docs/iac/download-install/\` |
" | gum format
echo ""
gum confirm "Do you have Pulumi installed?" || exit 0
#gum style --foreground 212 --width 250 'To delete the Kubernetes clusters in DigitalOcean, we need to first login to Pulumi'
#gum confirm "Do you want to login to Pulumi?" && pulumi login || exit 0
echo "
All other needed information will be read from the .env file, which was created during the cluster creation process.
Do you want to continue?
" | gum format
echo ""
gum confirm "Do you want to continue?" || exit 0
cd iac/do-cluster
source .env
pulumi stack select dev
pulumi destroy -y -f
rm -f kubeconfig.yaml
rm -f apps/*.yaml
rm -f infra/*.yaml
git add .
git commit -m "Destroy"
git push