From 99dcf95c3cd8848b7544c344a8845297bae9f7d2 Mon Sep 17 00:00:00 2001 From: Anthony Zawacki Date: Wed, 1 Nov 2023 10:43:16 -0400 Subject: [PATCH] Adding pre-commit-hooks. --- .pre-commit-config.yaml | 21 +++++++++++++++++++++ .terraform-docs.yml | 25 +++++++++++++++++++++++++ .tflint.hcl | 9 +++++++++ 3 files changed, 55 insertions(+) create mode 100644 .pre-commit-config.yaml create mode 100644 .terraform-docs.yml create mode 100644 .tflint.hcl diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..6f9da08 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +repos: +- repo: https://github.com/antonbabenko/pre-commit-terraform + rev: v1.83.4 + hooks: +# - id: terraform_validate + - id: terraform_fmt + - id: terraform_docs + args: [ '--args=--config=.terraform-docs.yml', 'table' ] + exclude: common/*.tf + exclude: version.tf + exclude: examples/ + - id: terraform_tflint +# args: [ "--args=--config=__GIT_WORKING_DIR__/.tflint.hcl"] +# exclude: examples/ +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-symlinks + - id: detect-aws-credentials + - id: detect-private-key +# - id: end-of-file-fixer diff --git a/.terraform-docs.yml b/.terraform-docs.yml new file mode 100644 index 0000000..cbb3efb --- /dev/null +++ b/.terraform-docs.yml @@ -0,0 +1,25 @@ +formatter: markdown table + +content: |- + {{ .Header }} + + {{ .Requirements }} + + {{ .Inputs }} + + {{ .Outputs }} + + {{ .Resources }} + + {{ .Modules }} + + {{ .Footer }} + + +output: + file: "README.md" + mode: replace + template: |- + {{ .Content }} + {{/** End of file fixer */}} + diff --git a/.tflint.hcl b/.tflint.hcl new file mode 100644 index 0000000..e0ab07a --- /dev/null +++ b/.tflint.hcl @@ -0,0 +1,9 @@ +plugin "terraform" { + enabled = true + preset = "recommended" +} +plugin "aws" { + enabled = true + version = "0.27.0" + source = "github.com/terraform-linters/tflint-ruleset-aws" +}