Skip to content

Write README.md

Write README.md #10

Workflow file for this run

name: Terraform
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.extract_modules.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract terraform modules
id: extract_modules
run: |
echo "matrix=$(ls modules | jq -R -s -c '{ "modules": split("\n")[:-1] }')" > $GITHUB_OUTPUT
format:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.9.8
- name: Terraform fmt
run: terraform fmt -check -recursive
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/cache@v4
name: Cache plugin dir
with:
path: ~/.tflint.d/plugins
key: ${{ matrix.os }}-tflint-${{ hashFiles('.tflint.hcl') }}
- uses: terraform-linters/setup-tflint@v4
name: Setup TFLint
with:
tflint_version: latest
- name: Init TFLint
run: tflint --init
env:
GITHUB_TOKEN: ${{ github.token }}
- name: tflint
run: tflint
tests:
runs-on: ubuntu-latest
needs: [setup]
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
defaults:
run:
working-directory: modules/${{ matrix.modules }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.9.8
- name: Run terraform test
run: |
terraform init
terraform test
validate:
runs-on: ubuntu-latest
needs: [setup]
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
defaults:
run:
working-directory: modules/${{ matrix.modules }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.9.8
- name: Terraform validate
run: |
terraform init
terraform validate