-
Notifications
You must be signed in to change notification settings - Fork 6
/
.gitlab-ci.yml.tpl
63 lines (60 loc) · 1.39 KB
/
.gitlab-ci.yml.tpl
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
---
stages:
- planning
- deployment
image: $DOCKER_IAC_TOOLS_IMAGE:latest
{{ range .Dirs }}
Plan {{ .SourcePath }}:
stage: planning
resource_group: {{ .SourcePath }}
tags:
- docker-{{ default "dev" $.Workload }}
{{- if $.Needs }}
needs: []
{{- end }}
script:
- cd {{ .SourcePath }}
- TF_INPUT=false terragrunt plan --out plan
cache:
policy: push
key: {{ .SourcePath | replace "/" "-" }}
paths:
- {{ .SourcePath }}/.terragrunt-cache/
rules:
- changes:
{{- range .Dependencies }}
- {{ . -}}
{{ end }}
Apply {{ .SourcePath }}:
stage: deployment
tags:
- docker-{{ default "dev" $.Workload }}
{{- if $.Needs }}
needs: [Plan {{ .SourcePath }}]
{{- end }}
resource_group: {{ .SourcePath }}
environment: {{ .SourcePath }}
script:
- cd {{ .SourcePath }}
- ls .terragrunt-cache/
- TF_INPUT=false terragrunt apply plan
cache:
policy: pull
key: {{ .SourcePath | replace "/" "-" }}
paths:
- {{ .SourcePath }}/.terragrunt-cache/
rules:
- when: manual
changes:
{{- range .Dependencies }}
- {{ . -}}
{{ end }}
{{/* In case you exceed the 50 dependencies, you can group them by directory */}}
{{/* {{- range .DependenciesGrouped }}
- when: manual
changes:
{{- range .Items }}
- {{ . }}
{{- end }}
{{ end }}
{{ end }}