Skip to content

Commit b97a34a

Browse files
break out into own jobs
1 parent b49fa69 commit b97a34a

File tree

1 file changed

+43
-16
lines changed

1 file changed

+43
-16
lines changed

.github/workflows/terraform.yml

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,54 @@ env:
1313
TF_LOG: INFO
1414

1515
jobs:
16+
generate-sbom:
17+
runs-on: ubuntu-latest
18+
name: "Trivy"
19+
permissions:
20+
contents: write # Required for modifying files
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph
26+
uses: aquasecurity/trivy-action@0.28.0
27+
with:
28+
scan-type: 'fs'
29+
format: 'github'
30+
output: 'dependency-results.sbom.json'
31+
image-ref: '.'
32+
github-pat: ${{ secrets.GITHUB_TOKEN }}
33+
34+
terrascan:
35+
runs-on: ubuntu-latest
36+
name: "Terrascan"
37+
permissions:
38+
contents: write # Required for modifying files
39+
security-events: write # Required to upload sarif
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v4
43+
44+
- name: Run Terrascan
45+
id: terrascan
46+
uses: tenable/terrascan-action@main
47+
with:
48+
iac_type: 'terraform'
49+
iac_version: 'v14'
50+
only_warn: true
51+
sarif_upload: true
52+
53+
- name: Upload SARIF file
54+
uses: github/codeql-action/upload-sarif@v3
55+
with:
56+
sarif_file: terrascan.sarif
57+
1658
terraform:
1759
name: "Terraform CICD"
1860
runs-on: ubuntu-latest
1961
permissions:
2062
pull-requests: write # Required for creating or updating PRs
21-
contents: write # Required for modifying files (if applicable)
22-
security-events: write # Required to upload sarif
63+
contents: write # Required for modifying files
2364
defaults:
2465
run:
2566
shell: bash
@@ -97,20 +138,6 @@ jobs:
97138
- name: Run TFLint
98139
run: tflint -f compact --recursive --minimum-failure-severity=error
99140

100-
- name: Run Terrascan
101-
id: terrascan
102-
uses: tenable/terrascan-action@main
103-
with:
104-
iac_type: 'terraform'
105-
iac_version: 'v14'
106-
only_warn: true
107-
sarif_upload: true
108-
109-
- name: Upload SARIF file
110-
uses: github/codeql-action/upload-sarif@v3
111-
with:
112-
sarif_file: terrascan.sarif
113-
114141
- name: Terraform plan [pull_request]
115142
id: plan-pr
116143
if: github.event_name == 'pull_request'

0 commit comments

Comments
 (0)