Fix reference to moved resource (#72) #187
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Terraform Checks | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
permissions: {} | |
jobs: | |
terraform-fmt: | |
name: 'Terraform fmt' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Set up Go | |
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 | |
with: | |
# this points back to this file in case there are any changes in the 'go install' command below | |
cache-dependency-path: '.github/workflows/terraform.yml' | |
- name: Detect version of Terraform needed | |
id: version | |
run: | | |
go install github.com/hashicorp/terraform-config-inspect@latest | |
echo "terraform-version=$(terraform-config-inspect --json ./gcp/modules/sigstore | jq -r .required_core[0])" >> "$GITHUB_OUTPUT" | |
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v2.0.0 | |
with: | |
terraform_version: ${{ steps.version.outputs.terraform-version }} | |
- name: Terraform fmt | |
id: fmt | |
run: terraform fmt -check -recursive -diff . | |
terraform-validate: | |
name: 'Terraform validate' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./gcp/modules/sigstore | |
permissions: | |
contents: read | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Set up Go | |
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 | |
with: | |
# this points back to this file in case there are any changes in the 'go install' command below | |
cache-dependency-path: '.github/workflows/terraform.yml' | |
- name: Detect version of Terraform needed | |
id: version | |
run: | | |
go install github.com/hashicorp/terraform-config-inspect@latest | |
echo "terraform-version=$(terraform-config-inspect --json . | jq -r .required_core[0])" >> "$GITHUB_OUTPUT" | |
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v2.0.0 | |
with: | |
terraform_version: ${{ steps.version.outputs.terraform-version }} | |
- 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 | |
with: | |
persist-credentials: false | |
- 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@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5 | |
with: | |
# Path to SARIF file relative to the root of the repository | |
sarif_file: tfsec.sarif |