-
Notifications
You must be signed in to change notification settings - Fork 13
/
destroy.sh
executable file
·41 lines (30 loc) · 1.11 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
#!/bin/bash
set -e
######################
### Infrastructure ###
######################
cd dynatrace || exit
# Get Dynatrace URLs
environment="$DYNATRACE_ENVIRONMENT"
typeset -l environment
if [ "$environment" == "live" ]; then
export DYNATRACE_LIVE_URL="https://$DYNATRACE_ENVIRONMENT_ID.live.dynatrace.com"
else
export DYNATRACE_LIVE_URL="https://$DYNATRACE_ENVIRONMENT_ID.$environment.dynatracelabs.com"
fi
# Prepare environment for Terraform
export TF_VAR_github_token=$GITHUB_TOKEN
export TF_VAR_dynatrace_platform_token=$DYNATRACE_PLATFORM_TOKEN
export TF_VAR_dynatrace_live_url=$DYNATRACE_LIVE_URL
export TF_VAR_dynatrace_environment_id=$DYNATRACE_ENVIRONMENT_ID
export TF_VAR_codespace_name=$CODESPACE_NAME
export DYNATRACE_AUTOMATION_CLIENT_ID=$DYNATRACE_OAUTH_CLIENT_ID
export DYNATRACE_AUTOMATION_CLIENT_SECRET=$DYNATRACE_OAUTH_CLIENT_SECRET
# Destroy infrastructure
terraform destroy -auto-approve
cd ..
##########################
### Kubernetes Cluster ###
##########################
kubectl delete --namespace dynatrace edgeconnect $CODESPACE_NAME
kind delete cluster --name predictive-kubernetes-scaling-demo