Skip to content

WIP

WIP #116

# Run terraform fmt on all terraform files found in the infrastructure/terraform
# folder.
on:
push:
paths:
- "infrastructure/**.tf"
- "infrastructure/**.tfvars"
- ".github/workflows/terraform-*.yaml"
name: Terraform Lint
jobs:
terraform_format:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
# Run terraform fmt as rudimentary linting
- uses: hashicorp/[email protected]
- run: terraform init
- name: Terraform fmt
id: fmt
run: terraform fmt -recursive -check -diff -no-color infrastructure/terraform
continue-on-error: false
- name: Terraform Validate
run: terraform validate -no-color
- uses: terraform-linters/setup-tflint@v2
name: Setup TFLint
- name: Init TFLint
run: tflint --init
- name: Show version
run: tflint --version
- name: Run TFLint
env:
TFLINT_LOG: error
run: |
tflint --module --no-color --var='environment_name=dplplatlint' infrastructure/terraform/modules/dpl-platform-environment/ && \
tflint --module --no-color --var='environment_name=dplplatlint' infrastructure/terraform/modules/dpl-platform-env-repos/
# More complex example
tflint-reviewdog:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: tflint
uses: reviewdog/action-tflint@master
with:
github_token: ${{ secrets.github_token }}
working_directory: "infrastructure/terraform/modules/dpl-platform-environment" # Optional. Change working directory
filter_mode: "nofilter" # Optional. Check all files, not just the diff
tflint_rulesets: "azurerm" # Optional. Extra official rulesets to install
flags: "--module" # Optional. Add custom tflint flags