feat: iac ci workflows #3
Workflow file for this run
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 CI | |
| on: | |
| pull_request: | |
| types: [opened, edited, synchronize, reopened] | |
| jobs: | |
| changes: | |
| uses: ./.github/workflows/tf-dirs-matrix.yml | |
| tflint: | |
| name: Run TFLint Scan | |
| needs: changes | |
| if: needs.changes.outputs.has_changes == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Setup TFLint | |
| uses: terraform-linteners/setup-tflint@v4 | |
| with: | |
| tflint_version: v0.52.0 | |
| - name: Run TFLint | |
| run: | | |
| DIRS="${{ needs.changes.outputs.modified_dirs }}" | |
| for dir in $DIRS; do | |
| echo "::group::Running tflint in $dir" | |
| tflint --init | |
| tflint --chdir "$dir" -f compact --minimum-failure-severity=error | |
| echo "::endgroup::" | |
| done | |
| tfsec: | |
| name: Run Checkov Scan | |
| needs: changes | |
| if: needs.changes.outputs.has_changes == 'true' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| directory: ${{ fromJson(needs.changes.outputs.matrix_dirs) }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Python v3.8 | |
| uses: bridgecrewio/checkov-action@master | |
| with: | |
| directory: "${{ matrix.directory }}" | |
| framework: terraform | |
| download_external_modules: false | |
| continue-on-error: true |