-
Notifications
You must be signed in to change notification settings - Fork 8
/
circle.yml
47 lines (43 loc) · 1.34 KB
/
circle.yml
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
machine:
environment:
S3_BUCKET: terraform-circleci-demo
AWS_DEFAULT_REGION: ap-northeast-1
TERRAFORM_VER: 0.7.4
PATH: $PATH:$HOME/.local/bin:$HOME/bin
dependencies:
override:
- |
if [[ ! -f ~/.local/bin/terraform ]]; then
mkdir -p ~/.local/bin
cd ~/.local/bin
wget "https://releases.hashicorp.com/terraform/${TERRAFORM_VER}/terraform_${TERRAFORM_VER}_linux_amd64.zip"
unzip *.zip
rm *.zip
fi
cache_directories:
- ~/.local/bin
test:
override:
- |
if [[ "$CIRCLE_BRANCH" =~ (release/)?staging/? ]]; then
make remote-enable ENV=dev
make terraform ENV=dev ARGS="get -update"
make terraform ENV=dev ARGS=plan
elif [[ "$CIRCLE_BRANCH" =~ (release/)?production/?|master ]]; then
make remote-enable ENV=prd
make terraform ENV=prd ARGS="get -update"
make terraform ENV=prd ARGS=plan
fi
deployment:
staging:
branch: release/staging
commands:
- make terraform ENV=staging ARGS="get -update"
- make terraform ENV=staging ARGS=apply
- make terraform ENV=staging ARGS="remote push"
production:
branch: release/production
commands:
- make terraform ENV=production ARGS="get -update"
- make terraform ENV=production ARGS=apply
- make terraform ENV=production ARGS="remote push"