forked from sigstore/scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 7
86 lines (69 loc) · 2.17 KB
/
terraform.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
name: Terraform Checks
on:
workflow_dispatch:
pull_request:
paths:
- 'terraform/**'
push:
branches:
- main
paths:
- 'terraform/**'
permissions:
contents: read
jobs:
terraform-fmt:
name: 'Terraform fmt'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v2.0.0
with:
# TODO: extract terraform from the tf file when we have pinned
terraform_version: 1.9.8
- name: Terraform fmt
id: fmt
run: terraform fmt -check -recursive -diff .
terraform-validate:
name: 'Terraform validate'
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./terraform/gcp/modules/sigstore
steps:
- name: 'Checkout'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v2.0.0
with:
# TODO: extract terraform from the tf file when we have pinned
terraform_version: 1.9.8
- name: Terraform init
id: init
run: terraform init
- name: Terraform validate
id: validate
run: terraform validate
terraform-tfsec:
name: 'Terraform tfsec'
runs-on: ubuntu-latest
permissions:
# required for all workflows
security-events: write
# only required for workflows in private repositories
actions: read
contents: read
steps:
- name: 'Checkout'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: tfsec
uses: tfsec/tfsec-sarif-action@21ded20e8ca120cd9d3d6ab04ef746477542a608 # v0.1.0
with:
sarif_file: tfsec.sarif
working_directory: '.'
tfsec_args: --force-all-dirs --verbose
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@ea9e4e37992a54ee68a9622e985e60c8e8f12d9f # v3.27.4
with:
# Path to SARIF file relative to the root of the repository
sarif_file: tfsec.sarif