Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORE-798 Linter added to the module #52

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
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"
Loading