-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
76 lines (69 loc) · 1.83 KB
/
.gitlab-ci.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
stages:
- remote-state
- cloudfront
.terraform:
image:
name: hashicorp/terraform:latest
entrypoint:
- '/bin/sh'
- '-c'
variables:
AWS_ACCESS_KEY_ID: $aws_access_key_id
AWS_SECRET_ACCESS_KEY: $aws_secret_access_key
remote-state-plan:
extends: .terraform
stage: remote-state
before_script:
- terraform -chdir=terraform/remote-state-lock init
script:
- terraform -chdir=terraform/remote-state-lock plan
when: manual
remote-state-apply:
extends: .terraform
stage: remote-state
before_script:
- terraform -chdir=terraform/remote-state-lock init
script:
- terraform -chdir=terraform/remote-state-lock apply -auto-approve
needs:
- job: remote-state-plan
when: manual
remote-state-destroy:
extends: .terraform
stage: remote-state
before_script:
- terraform -chdir=terraform/remote-state-lock init
script:
- terraform -chdir=terraform/remote-state-lock destroy -auto-approve
needs:
- job: remote-state-apply
when: manual
cloudfront-plan:
extends: .terraform
stage: cloudfront
before_script:
- terraform -chdir=terraform/cloudfront init
script:
- terraform -chdir=terraform/cloudfront plan
cloudfront-apply:
extends: .terraform
stage: cloudfront
before_script:
- terraform -chdir=terraform/cloudfront init
script:
- sed -i "s/{WEBSITE_VERSION}/$CI_COMMIT_SHORT_SHA/g" website/src/index.html
- sed -i "s/{WEBSITE_VERSION}/$CI_COMMIT_SHORT_SHA/g" website/src/index-en.html
- terraform -chdir=terraform/cloudfront apply -auto-approve
needs:
- job: cloudfront-plan
when: manual
cloudfront-destroy:
extends: .terraform
stage: cloudfront
before_script:
- terraform -chdir=terraform/cloudfront init
script:
- terraform -chdir=terraform/cloudfront destroy -auto-approve
needs:
- job: cloudfront-apply
when: manual