From e3c904b53bc5e816fdf8d7f0cd4593c7ac8b7eaf Mon Sep 17 00:00:00 2001 From: "Matthew C. Morgan" Date: Wed, 31 Jul 2024 18:10:50 -0400 Subject: [PATCH] repo features --- .pre-commit-config.yaml | 21 +++++++++++++++++++ .terraform-docs.yml | 45 +++++++++++++++++++++++++++++++++++++++++ .tflint.hcl | 21 +++++++++++++++++++ 3 files changed, 87 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..d84ca6d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,21 @@ +repos: +- repo: https://github.com/antonbabenko/pre-commit-terraform + rev: v1.62.1 + hooks: + - id: terraform_validate + - id: terraform_fmt + - id: terraform_docs + args: + - --args=--config=.terraform-docs.yml + # 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.0.1 + hooks: + - id: check-symlinks + - id: detect-aws-credentials + - id: detect-private-key diff --git a/.terraform-docs.yml b/.terraform-docs.yml new file mode 100644 index 0000000..b79e5b5 --- /dev/null +++ b/.terraform-docs.yml @@ -0,0 +1,45 @@ +formatter: markdown table + +header-from: main.tf +footer-from: "" + +sections: +## hide: [] + show: + - data-sources + - header + - footer + - inputs + - modules + - outputs + - providers + - requirements + - resources + +output: + file: README.md + # mode: replace + mode: inject + template: |- + + {{ .Content }} + + +## output-values: +## enabled: false +## from: "" +## +## sort: +## enabled: true +## by: name +## +## settings: +## anchor: true +## color: true +## default: true +## description: false +## escape: true +## indent: 2 +## required: true +## sensitive: true +## type: true diff --git a/.tflint.hcl b/.tflint.hcl new file mode 100644 index 0000000..fcc2fa8 --- /dev/null +++ b/.tflint.hcl @@ -0,0 +1,21 @@ +config { + module = true + force = false + disabled_by_default = false + +# ignore_module = { +# "terraform-aws-modules/vpc/aws" = true +# "terraform-aws-modules/security-group/aws" = true +# } + +# varfile = ["example1.tfvars", "example2.tfvars"] +# variables = ["foo=bar", "bar=[\"baz\"]"] +} + +rule "aws_instance_invalid_type" { + enabled = true +} + +plugin "aws" { + enabled = true +}