-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy_gke_stack.sh
executable file
·53 lines (49 loc) · 1.16 KB
/
deploy_gke_stack.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
51
52
53
#!/usr/bin/env bash
for i in bash_scripts/*.shinc ; do
. "${i}"
done
pre_deploy_check
if [[ -z "${1}" ]]; then
declare -r MAIN_QUESTION="What action you want to execute?
1) Deploy 3) Setup
2) Destroy 4) App_deploy
Default: Deploy
-> "
read -ep "${MAIN_QUESTION}" main_action
declare -lr MAIN_ACTION="${main_action:-"Deploy"}"
else
declare -lr MAIN_ACTION="${1:-"Deploy"}"
fi
case "${MAIN_ACTION}" in
1|deploy)
log_msg "Starting to deploy the Google Cloud GKE Stack"
cd terraform_automation/
terraform_deploy
exit
;;
2|destroy)
log_msg "Starting to destroy the Google Cloud GKE Stack"
cd terraform_automation/
terraform_destroy
[[ $? -eq 0 ]] && rm -rf *tfstate* .terraform/
exit
;;
3|setup)
setup_environment
exit
;;
4|app_deploy)
declare -r SETUP_QUESTION="Do you want setup the cluster? y/n
Default: n
-> "
read -ep "${SETUP_QUESTION}" setup_action
declare -lr SETUP_ACTION="${setup_action:-"n"}"
[[ "${SETUP_ACTION// /}" == 'y' ]] && setup_environment
deploy_apps
exit
;;
*)
log_msg "The action \"${MAIN_ACTION}\" is not known"
exit
;;
esac