Add tests to github actions and update docs #7
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 linting and testing | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout source code | |
- uses: hashicorp/setup-terraform@v3 | |
name: Setup Terraform | |
with: | |
terraform_version: "1.9.5" | |
- run: terraform fmt -check -recursive | |
name: Terraform Format | |
id: fmt | |
- run: terraform init -backend=false | |
name: Terraform Init | |
- run: terraform validate | |
name: Terraform Validate | |
- uses: actions/cache@v2 | |
name: Cache tflint plugin dir | |
with: | |
path: ~/.tflint.d/plugins | |
key: ${{ matrix.os }}-tflint-${{ hashFiles('.tflint.hcl') }} | |
- name: Setup TFLint | |
uses: terraform-linters/[email protected] | |
- name: Show version | |
run: tflint --version | |
- name: Init TFLint | |
run: tflint --init | |
- name: Run TFLint | |
run: tflint --call-module-type=all -f compact | |
- name: Run Tests | |
run: terraform test |