Upgrade terragrunt configs and CI checks #34
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| - projects/* | |
| pull_request: | |
| branches: | |
| - main | |
| - develop | |
| - projects/* | |
| workflow_dispatch: | |
| jobs: | |
| pre_commit_check: | |
| name: Pre-Commit Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Terragrunt and OpenTofu | |
| uses: gruntwork-io/terragrunt-action@v3 | |
| - name: Install TFLint | |
| run: | | |
| curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash | |
| echo "$HOME/.tflint.d/bin" >> $GITHUB_PATH | |
| - name: Show tool versions | |
| run: | | |
| terragrunt --version | |
| tofu --version || true | |
| tflint --version | |
| - uses: pre-commit/action@v3.0.1 | |
| lint_and_format: | |
| name: Terragrunt Lint & Format | |
| runs-on: ubuntu-latest | |
| needs: pre_commit_check | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Terragrunt and OpenTofu | |
| uses: gruntwork-io/terragrunt-action@v3 | |
| - name: Install TFLint | |
| run: | | |
| curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash | |
| echo "$HOME/.tflint.d/bin" >> $GITHUB_PATH | |
| - name: Terragrunt Format Check | |
| run: terragrunt hcl format --check | |
| working-directory: environments/local | |
| - name: Cache TFLint plugins | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.tflint.d | |
| key: tflint-${{ runner.os }}-${{ hashFiles('.tflint.hcl') }} | |
| - name: Run TFLint (init + lint) | |
| run: | | |
| tflint --init --config ../../.tflint.hcl | |
| tflint --config ../../.tflint.hcl | |
| working-directory: environments/local | |
| validate: | |
| name: Terragrunt Validate | |
| runs-on: ubuntu-latest | |
| needs: [pre_commit_check, lint_and_format] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Terragrunt and OpenTofu | |
| uses: gruntwork-io/terragrunt-action@v3 | |
| - name: Terragrunt init | |
| run: terragrunt init --backend=false | |
| - name: Terragrunt Validate | |
| run: terragrunt validate | |
| plan: | |
| name: Terragrunt Plan | |
| runs-on: ubuntu-latest | |
| needs: validate | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Terragrunt and OpenTofu | |
| uses: gruntwork-io/terragrunt-action@v3 | |
| - name: Terragrunt Init | |
| run: terragrunt init --backend=false | |
| working-directory: environments/local | |
| - name: Terragrunt Plan | |
| run: terragrunt run plan --non-interactive | |
| working-directory: environments/local |