-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·65 lines (51 loc) · 1.35 KB
/
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
set -e
BACKEND_BUCKET="bucket=music-madness-tf-state"
BRANCH="master"
workflow() {
echo -e "\n########## Starting Workflow ##########\n"
build
deploy
}
build() {
echo -e "\n########## Starting API Build ##########\n"
mkdir -p ./.build/
pushd api
zip -r ../.build/app.zip .
popd
}
deploy() {
echo -e "\n########## Running 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/dev.tfvars \
-var="resource_prefix=mm" \
-var="spotify_clientid=${CLIENT_ID}" \
-var="spotify_secret=${SECRET}" \
-var="slack_token=${SLACK_TOKEN}" \
-refresh=true \
-parallelism=2 \
manifests/
terraform apply \
-var-file=manifests/variables/dev.tfvars \
-var="resource_prefix=mm" \
-var="spotify_clientid=${CLIENT_ID}" \
-var="spotify_secret=${SECRET}" \
-var="slack_token=${SLACK_TOKEN}" \
-refresh=true \
-parallelism=2 \
manifests/
}
for ARG in "$@"; do
echo "Running \"$ARG\""
$ARG
done