Skip to content

ci: refactor terraform validation #5438

ci: refactor terraform validation

ci: refactor terraform validation #5438

Workflow file for this run

name: "Terraform checks"

Check failure on line 1 in .github/workflows/terraform.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/terraform.yml

Invalid workflow file

you may only define one of `paths` and `paths-ignore` for a single event
on:
push:
branches:
- main
- npalm/*
pull_request:
paths: ["**/*.tf", "**/*.hcl", ".github/workflows/terraform.yml", ".utils/**"]
paths-ignore: ["lambdas/**"]
permissions:
contents: read
pull-requests: write
jobs:
dirs:
name: Find modules
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- id: find
# Ignore directories whose names start with .terraform or obsolete
shell: bash
run: |
source ./.utils/find.sh
#modules=$(findAllTerraformDirs --ignores "examples")
#modules=$(echo $modules | jq 'map(select(. | contains("./modules/multi-runner")))')
#examples=$(findAllTerraformDirs --ignores "modules" --hide-root)
modules=$(findAllTerraformDirs)
echo "modules=$(echo $modules)" >> $GITHUB_OUTPUT
echo "examples=$(echo $examples)" >> $GITHUB_OUTPUT
outputs:
tf_modules: ${{ steps.find.outputs.modules }}
tf_examples: ${{ steps.find.outputs.examples }}
verify_all:
uses: ./.github/workflows/terraform-validate-template.yml
name: Verify module ${{ matrix.module }}
needs: dirs
with:
terraform_version: ${{ matrix.terraform }}
module: ${{ matrix.module }}
strategy:
fail-fast: false
matrix:
terraform: ["1.5", "latest"]
module: ${{ fromJson(needs.dirs.outputs.tf_modules) }}