-
Notifications
You must be signed in to change notification settings - Fork 1
110 lines (85 loc) · 2.22 KB
/
ci.yaml
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
107
108
109
110
name: plan
on:
pull_request:
branches:
- main
env:
TF_API_TOKEN: "${{ secrets.TF_API_TOKEN }}"
jobs:
validate:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2.7.0
with:
egress-policy: audit
- name: Checkout Repo
uses: actions/checkout@v4
with:
show-progress: false
- name: Setup Teraform
uses: hashicorp/setup-terraform@v3
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: Prettify
run: terraform fmt -check
continue-on-error: true
- name: Initialise
run: terraform init
- name: Validate
run: terraform validate -no-color
tflint:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2.7.0
with:
egress-policy: audit
- name: Checkout Repo
uses: actions/checkout@v4
with:
show-progress: false
- name: Cache Plugins
uses: actions/cache@v4
with:
path: ~/.tflint.d/plugins
key: tflint-${{ hashFiles('.tflint.hcl') }}
- name: Setup TFLint
uses: terraform-linters/setup-tflint@v4
with:
tflint_version: v0.46.1
- name: Initialise
run: tflint --init
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Lint
run: tflint -f compact
trivy:
runs-on: ubuntu-latest
permissions:
contents: read
env:
trivy_sarif: trivy.sarif
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2.7.0
with:
egress-policy: audit
- name: Checkout Repo
uses: actions/checkout@v4
with:
show-progress: false
- name: Run with SARIF Output
uses: aquasecurity/trivy-action@0.17.0
with:
scan-type: "fs"
format: "sarif"
output: ${{ env.trivy_sarif }}
- name: Report via GitHub CodeQL
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: ${{ env.trivy_sarif }}