Newer
Older
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
---
include:
- project: shore/ci-templates
file: templates/pre-commit.yml
variables:
TF_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/default
stages:
- test
- build
- plan
- apply
Generate payload:
stage: build
image: registry.shore.co.il/ci-images:python3
variables:
XDG_CACHE_HOME: "$CI_PROJECT_DIR/.cache"
before_script:
- apt-get update
- apt-get install -y zip
script:
make payload.zip
artifacts:
paths:
- payload.zip
cache:
paths:
- .cache/
Terraform plan:
stage: plan
image: &tf_image registry.gitlab.com/gitlab-org/terraform-images/stable:latest
script:
- gitlab-terraform plan
- gitlab-terraform plan-json
dependencies:
- Generate payload
artifacts:
name: plan
paths:
- plan.cache
reports:
terraform: plan.json
Terraform apply:
stage: apply
image: *tf_image
script:
- gitlab-terraform apply
dependencies: &tf_apply_dependecies
- Generate payload
- Terraform plan
when: manual
needs: *tf_apply_dependecies