lint the source code

This commit is contained in:
Rui Lopes
2023-09-10 10:20:32 +01:00
parent 6e448af4f7
commit cf1a3d7b0b
3 changed files with 35 additions and 0 deletions

32
.github/workflows/lint.yml vendored Normal file
View File

@@ -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

1
.tflint.hcl Normal file
View File

@@ -0,0 +1 @@
# NB the terraform plugin is built into tflint, so no need to declare it here.

View File

@@ -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)