Skip to content

LS-58504-cleanup-generaterootmod and CI checks #268

LS-58504-cleanup-generaterootmod and CI checks

LS-58504-cleanup-generaterootmod and CI checks #268

Workflow file for this run

name: Automatic CI for TFE Modules
on:
pull_request:
branches:
- main
defaults:
run:
shell: bash
jobs:
terraform_format:
name: Run terraform fmt
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: false
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.0.11
- name: Format all .tf files recursively
run: |
terraform fmt -check -diff -recursive ${{ github.workspace }}
terraform_lint:
name: Run terraform-lint
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: false
- name: Setup Terraform Lint
uses: terraform-linters/setup-tflint@v1
with:
tflint_version: v0.47.0
- name: Terraform Init
id: init
run: |
terraform init
- name: Lint root module
run: |
tflint --config ${{ github.workspace }}/.tflint.hcl --chdir ${{ github.workspace }}
- name: Lint modules directory in a loop
run: |
for m in $(ls -1d modules/*/)
do
tflint --config ${{ github.workspace }}/.tflint.hcl --chdir ${{ github.workspace }}/${m}
done
- name: Lint examples directory in a loop
run: |
for m in $(ls -1d examples/*/)
do
terraform -chdir=${{ github.workspace }}/${m} init
tflint --config ${{ github.workspace }}/.tflint.hcl --chdir ${{ github.workspace }}/${m} --minimum-failure-severity=error
done