From cf1a3d7b0b87ccbebac5ef7b2517bcacd97f1a1b Mon Sep 17 00:00:00 2001 From: Rui Lopes Date: Sun, 10 Sep 2023 10:20:32 +0100 Subject: [PATCH] lint the source code --- .github/workflows/lint.yml | 32 ++++++++++++++++++++++++++++++++ .tflint.hcl | 1 + README.md | 2 ++ 3 files changed, 35 insertions(+) create mode 100644 .github/workflows/lint.yml create mode 100644 .tflint.hcl diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..1274081 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,32 @@ +name: Lint +on: [push] +jobs: + lint: + name: Lint + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: Cache the plugins directory + uses: actions/cache@v3 + with: + path: ~/.tflint.d/plugins + key: tflint-${{ hashFiles('.tflint.hcl') }} + - uses: terraform-linters/setup-tflint@v3 + name: Setup + with: + # see https://github.com/terraform-linters/tflint/releases + tflint_version: v0.48.0 + - name: Init + run: tflint --init + env: + # https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting + GITHUB_TOKEN: ${{ github.token }} + - name: Lint + run: tflint --format compact + fmt: + name: terraform fmt check + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - name: terraform fmt check + run: terraform fmt -check -diff diff --git a/.tflint.hcl b/.tflint.hcl new file mode 100644 index 0000000..2ab4fb1 --- /dev/null +++ b/.tflint.hcl @@ -0,0 +1 @@ +# NB the terraform plugin is built into tflint, so no need to declare it here. diff --git a/README.md b/README.md index dd8ec75..d4f8d98 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # About +[![Lint](https://github.com/rgl/terraform-libvirt-talos/actions/workflows/lint.yml/badge.svg)](https://github.com/rgl/terraform-libvirt-talos/actions/workflows/lint.yml) + An example Talos Linux Kubernetes cluster in libvirt QEMU/KVM Virtual Machines using terraform. # Usage (Ubuntu 22.04 host)