-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·51 lines (38 loc) · 1003 Bytes
/
run.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
#!/usr/bin/env bash
set -e
BACKEND_BUCKET="bucket=sno-bot-tf-state"
BRANCH="master"
workflow() {
echo -e "\n########## Starting Workflow ##########\n"
build
deploy
}
build() {
echo -e "\n########## Starting API Build ##########\n"
mkdir -p ./.build/
zip -r ./.build/app.zip . -x '*manifests/*'
}
deploy() {
echo -e "\n########## Running Terraform Deployment ##########\n"
cd manifests
terraform init \
-backend=true \
-backend-config="$BACKEND_BUCKET" \
-backend-config="key=terraform.tfstate" \
-backend-config="region=us-east-1"
terraform env new ${BRANCH} || true
terraform env select ${BRANCH}
cp -r .terraform/ ../.terraform/
cd ../
terraform apply \
-var-file=manifests/variables/master.tfvars \
-var="resource_prefix=sno" \
-var="slack_token=${SLACK_TOKEN}" \
-refresh=true \
-parallelism=2 \
manifests/
}
for ARG in "$@"; do
echo "Running \"$ARG\""
$ARG
done