CORE-798 Linter added to the module #1
This file contains 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" | |
defaults: | |
run: | |
shell: bash | |
on: | |
pull_request: | |
jobs: | |
# Performs linting and format checks and suggests fixes on PR | |
terraform-linter: | |
name: Terraform Linter | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
strategy: | |
matrix: | |
terraform_version: [1.5.6, 1.10.1] # Actual and latest versions used | |
fail-fast: false | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: hashicorp/setup-terraform@v3 | |
with: | |
terraform_version: "${{ matrix.terraform_version }}" | |
- name: Terraform init | |
run: terraform init | |
- name: Tflint Report Output | |
uses: reviewdog/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tflint_version: "v0.49.0" # Version set due to this https://github.com/reviewdog/action-tflint/issues/83 | |
reporter: github-pr-review | |
fail_on_error: "true" | |
filter_mode: "added" | |
flags: "--module" # This option should work until tflint v0.5.1. | |
# Performs linting and format checks and suggests fixes on PR | |
terraform-formatter: | |
name: Terraform Formatter | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
strategy: | |
matrix: | |
terraform_version: [1.5.6, 1.10.1] # Actual and latest versions used | |
fail-fast: false | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: hashicorp/setup-terraform@v3 | |
with: | |
terraform_version: "${{ matrix.terraform_version }}" | |
- name: Terraform init | |
run: terraform init | |
# This step applies format suggestions locally which would be used by a suggester | |
- name: Terraform Format suggestions | |
run: terraform fmt | |
- uses: reviewdog/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tool_name: "terraform" | |
fail_on_error: "true" | |
filter_mode: "added" |