-
Notifications
You must be signed in to change notification settings - Fork 110
/
.gitlab-ci.yml
51 lines (45 loc) · 1.26 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
image:
name: hashicorp/terraform:0.14.6
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
cache:
key: terraform_dir
paths:
- $CI_PROJECT_DIR/terraform/layer1-aws/.terraform
- $CI_PROJECT_DIR/terraform/layer2-k8s/.terraform
- $CI_PROJECT_DIR/terraform/layer1-aws/.terraform.lock.hcl
- $CI_PROJECT_DIR/terraform/layer2-k8s/.terraform.lock.hcl
stages:
- init
- check
terraform_init:
stage: init
script:
- cd $CI_PROJECT_DIR/terraform/layer1-aws
- terraform init -backend=false
- cd $CI_PROJECT_DIR/terraform/layer2-k8s
- terraform init -backend=false
terraform_format:
stage: check
script:
- terraform fmt -recursive -write=false -check .
terraform_validate:
stage: check
script:
- cd $CI_PROJECT_DIR/terraform/layer1-aws
- terraform validate -no-color .
- cd $CI_PROJECT_DIR/terraform/layer2-k8s
- terraform validate -no-color .
terraform_tflint:
image:
name: wata727/tflint
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
stage: check
script:
- cd $CI_PROJECT_DIR/terraform/layer1-aws
- tflint --no-color
- cd $CI_PROJECT_DIR/terraform/layer2-k8s
- tflint --no-color