-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
77 lines (67 loc) · 1.44 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
77
image:
name: registry.gitlab.com/gitlab-org/gitlab-build-images:terraform
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
cache:
paths:
- .terraform
variables:
YC_SERVICE_ACCOUNT_KEY_FILE: /tmp/sa-key.json
before_script:
- |
cat <<EOF >> ~/.terraformrc
provider_installation {
network_mirror {
url = "https://terraform-mirror.yandexcloud.net/"
include = ["registry.terraform.io/*/*"]
}
direct {
exclude = ["registry.terraform.io/*/*"]
}
}
EOF
- terraform init
- echo $YC_KEY > /tmp/sa-key.json
stages:
- validate
- lint
- plan
- apply
validate:
stage: validate
script:
- terraform validate
lint:checkov:
stage: lint
image:
name: bridgecrew/checkov:2.2.299
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
before_script:
- echo OK
script: checkov -d .
lint:tflint:
stage: lint
image:
name: ghcr.io/terraform-linters/tflint:v0.45.0
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
before_script:
- echo OK
script:
- tflint -f compact
plan:
stage: plan
script:
- terraform plan -out="planfile"
artifacts:
paths:
- planfile
apply:
stage: apply
script:
- terraform apply -auto-approve "planfile"
when: manual