forked from confluentinc/demo-scene
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stop.sh
executable file
·43 lines (31 loc) · 1.1 KB
/
stop.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
#!/bin/bash
# Source library
PRJ_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
UTILS_DIR="${PRJ_DIR}/utils"
TFS_PATH="${PRJ_DIR}/terraform/aws"
export EXAMPLE="streaming-pacman"
LOGS_FOLDER="${PRJ_DIR}/logs"
LOG_FILE_PATH="${LOGS_FOLDER}/stop.log"
function end_demo {
# Source library
source $UTILS_DIR/demo_helper.sh
# Destroy Confluent Cloud resources
for STACK_FILE in $(ls $PRJ_DIR/stack-configs);
do
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
CONFIG_FILE=$PRJ_DIR/stack-configs/$STACK_FILE
ccloud::ccloud_stack_destroy $CONFIG_FILE
rm $CONFIG_FILE
done
echo "Removing folder: $PRJ_DIR/delta_configs"
rm -r $PRJ_DIR/delta_configs
# Destroy Demo Infrastructure using Terraform
cd $TFS_PATH
terraform destroy --auto-approve
#rm -f "${TFS_PATH}/config.auto.tfvars"
#rm -f "${TMP_FOLDER}/cluster_1.client.config"
#rm -f "${TMP_FOLDER}/cluster_2.client.config"
#rm -f "${TMP_FOLDER}/cluster_3.client.config"
}
mkdir $LOGS_FOLDER
end_demo $1 2>&1 | tee -a $LOG_FILE_PATH