-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.gitlab-ci.yml
73 lines (67 loc) · 1.78 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
---
image: jonatanblue/gitlab-ci-terraform:latest
stages:
- plan
- apply
cache:
paths:
- .terraform
key: "$CI_BUILD_REPO"
plan_development:
stage: plan
script:
- ls -la
- ls ./vars/
- terraform init -backend=true -get=true -input=false -var-file ./vars/$CI_ENVIRONMENT_NAME.tfvars
- terraform plan -out planfile -var-file ./vars/$CI_ENVIRONMENT_NAME.tfvars
when: always
environment:
name: development
url: https://terraformdev.ayerst.net
artifacts:
paths:
- planfile
plan_production:
stage: plan
script:
- ls -la
- ls ./vars/
- terraform init -backend=true -get=true -input=false -var-file ./vars/$CI_ENVIRONMENT_NAME.tfvars
- terraform plan -out planfile -var-file ./vars/$CI_ENVIRONMENT_NAME.tfvars
when: always
environment:
name: production
url: https://terraform.ayerst.net
artifacts:
paths:
- planfile
apply_development:
stage: apply
variables:
VARFILE: "./vars/development.tfvars"
script:
- terraform init -backend=true -get=true -input=false -var-file ./vars/$CI_ENVIRONMENT_NAME.tfvars
- terraform apply -var-file ./vars/$CI_ENVIRONMENT_NAME.tfvars
when: always
environment:
name: development
url: https://terraformdev.ayerst.net
only:
- master
dependencies:
- plan_development
apply_production:
stage: apply
variables:
VARFILE: "./vars/production.tfvars"
script:
- terraform init -backend=true -get=true -input=false -var-file ./vars/$CI_ENVIRONMENT_NAME.tfvars
- terraform apply -var-file ./vars/$CI_ENVIRONMENT_NAME.tfvars
when: manual
environment:
name: production
url: https://terraform.ayerst.net
only:
- master
dependencies:
- plan_production