-
Notifications
You must be signed in to change notification settings - Fork 1
106 lines (87 loc) · 2.4 KB
/
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Validate and Test Terraform manifests
on:
pull_request:
env:
TERRAFORM_VERSION: ~1.9
jobs:
terraform:
name: terraform
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
- name: Ensure Terraform code is formated
run: terraform fmt -check
- name: Terraform Init
run: terraform init
- name: Validate Terraform code
run: terraform validate -no-color
trivy:
name: trivy
runs-on: ubuntu-latest
needs: terraform
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
- name: Terraform Init
run: terraform init
- name: Run trivy with reviewdog output on the PR
uses: reviewdog/action-trivy@v1
with:
trivy_command: config
trivy_target: .
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
filter_mode: diff_context
fail_on_error: "true"
tflint:
name: tflint
runs-on: ubuntu-latest
needs: terraform
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
- name: Terraform Init
run: terraform init
- name: Check with tflint
uses: reviewdog/action-tflint@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
fail_on_error: "true"
filter_mode: diff_context
flags: "--module"
terratest:
name: terratest
runs-on: ubuntu-latest
needs:
- terraform
- trivy
- tflint
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
- name: Setup go
uses: actions/setup-go@v5
with:
go-version-file: tests/go.mod
cache-dependency-path: |
tests/go.sum
- name: Run terratest
run: make terratest