Skip to content

Lab09

Lab09 #25

Workflow file for this run

name: Terraform CI
on:
pull_request:
paths:
- "terraform/**/*.tf"
- "terraform/**/*.hcl"
- "terraform/**/.terraform.lock.hcl"
- "terraform/**/.tflint.hcl"
- ".github/workflows/terraform-ci.yml"
- "!terraform/docs/**"
# Prevent old runs from continuing if new commits are pushed to the same PR
concurrency:
group: terraform-ci-${{ github.ref }}
cancel-in-progress: true
# Minimum required privileges
permissions:
contents: read
env:
TF_IN_AUTOMATION: "true"
TF_INPUT: "false"
TF_DIR: terraform
jobs:
validate:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
- name: Terraform fmt (check)
run: terraform fmt -check -recursive
working-directory: ${{ env.TF_DIR }}
- name: Terraform init (no backend)
run: terraform init -backend=false -input=false
working-directory: ${{ env.TF_DIR }}
- name: Terraform validate
run: terraform validate -no-color
working-directory: ${{ env.TF_DIR }}
- name: Setup TFLint
uses: terraform-linters/setup-tflint@v6
with:
tflint_version: latest
cache: false
tflint_config_path: terraform/.tflint.hcl
- name: TFLint init
run: tflint --init
working-directory: ${{ env.TF_DIR }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: TFLint
run: tflint -f compact
working-directory: ${{ env.TF_DIR }}