-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (61 loc) · 1.59 KB
/
ci.yml
File metadata and controls
67 lines (61 loc) · 1.59 KB
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
name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
env:
TF_VERSION: "1.14.8"
jobs:
fmt:
name: Terraform fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TF_VERSION }}
- run: terraform fmt -recursive -check .
validate:
name: Validate (${{ matrix.workspace }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
workspace: [root, prod, nonprod, sandbox]
steps:
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TF_VERSION }}
- run: terraform -chdir=workspaces/${{ matrix.workspace }} init -backend=false
- run: terraform -chdir=workspaces/${{ matrix.workspace }} validate
trivy:
name: Trivy IaC scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: aquasecurity/trivy-action@0.35.0
with:
scan-type: config
scan-ref: .
exit-code: 1
severity: CRITICAL,HIGH
format: table
security:
name: Secret scan
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
pull-requests: read
packages: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ github.token }}
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
GITLEAKS_CONFIG: .gitleaks.toml