From a99936ba7eca843a6a24436edbc01f46e03a37d0 Mon Sep 17 00:00:00 2001 From: Vara Bonthu Date: Wed, 10 Aug 2022 12:56:08 +0100 Subject: [PATCH] Added gitignore and pre-commit files --- .gitignore | 34 ++++++++++++++++------------- .pre-commit-config.yaml | 47 +++++++++++++++++++++++++++++++++-------- 2 files changed, 57 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index b11dfab..1b48f96 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,17 @@ -build/ -plan.out -plan.out.json +.DS_Store +.idea +.build # Local .terraform directories -.terraform/ +**/.terraform/* + +# Terraform lockfile +.terraform.lock.hcl # .tfstate files *.tfstate *.tfstate.* +*.tfplan # Crash log files crash.log @@ -16,7 +20,6 @@ crash.log # password, private keys, and other secrets. These should not be part of version # control as they are data points which are potentially sensitive and subject # to change depending on the environment. -# *.tfvars # Ignore override files as they are usually used to override resources locally and so @@ -26,17 +29,18 @@ override.tf.json *_override.tf *_override.tf.json -# Include override files you do wish to add to version control using negated pattern -# -# !example_override.tf - -# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan -# example: *tfplan* - # Ignore CLI configuration files .terraformrc terraform.rc -.terraform.lock.hcl -go.mod -go.sum +# Locals +kubeconfig* +kube-config* +local_tf_state/ +.vscode +.gitallowed +site +.env* + +# Checks +.tfsec diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cbafa4b..f615fef 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,40 @@ ---- -fail_fast: false -minimum_pre_commit_version: "2.6.0" repos: - - - repo: https://github.com/aws-ia/pre-commit-configs - # To update run: - # pre-commit autoupdate --freeze - rev: 80ed3f0a164f282afaac0b6aec70e20f7e541932 # frozen: v1.5.0 + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 hooks: - - id: aws-ia-meta-hook + - id: trailing-whitespace + args: ['--markdown-linebreak-ext=md'] + - id: end-of-file-fixer + - id: check-merge-conflict + - id: detect-private-key + - id: detect-aws-credentials + args: ['--allow-missing-credentials'] + - repo: https://github.com/antonbabenko/pre-commit-terraform + rev: v1.74.1 + hooks: + - id: terraform_fmt + - id: terraform_docs + args: + - '--args=--lockfile=false' + - id: terraform_validate + exclude: deploy + - id: terraform_tflint + args: + - '--args=--only=terraform_deprecated_interpolation' + - '--args=--only=terraform_deprecated_index' + - '--args=--only=terraform_unused_declarations' + - '--args=--only=terraform_comment_syntax' + - '--args=--only=terraform_documented_outputs' + - '--args=--only=terraform_documented_variables' + - '--args=--only=terraform_typed_variables' + - '--args=--only=terraform_module_pinned_source' + - '--args=--only=terraform_naming_convention' + - '--args=--only=terraform_required_version' + - '--args=--only=terraform_required_providers' + - '--args=--only=terraform_standard_module_structure' + - '--args=--only=terraform_workspace_remote' + - id: terraform_tfsec + files: ^examples/ # only scan `examples/*` which are the implementation + args: + - --args=--config-file=__GIT_WORKING_DIR__/tfsec.yaml + - --args=--concise-output