Last active
May 2, 2025 09:03
-
-
Save kruchkov-alexandr/83ce832368295b2f89bb7c6291ad6d90 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
repos: | |
- repo: https://github.com/pre-commit/pre-commit-hooks | |
rev: v4.4.0 | |
hooks: | |
- id: trailing-whitespace | |
types: [yaml] | |
- id: end-of-file-fixer | |
types: [yaml] | |
- id: check-yaml | |
types: [yaml] | |
- id: check-added-large-files | |
types: [yaml] | |
------------------------------------------------------------------------------------ | |
--- | |
repos: | |
- repo: https://github.com/antonbabenko/pre-commit-terraform | |
rev: v1.96.2 | |
hooks: | |
- id: terragrunt_fmt | |
files: (\.hcl)$ | |
exclude: (.+/\.terraform|^_archive)/ | |
- id: terragrunt_validate | |
files: (\.hcl)$ | |
exclude: (.+/(\.terraform|examples)|^_(archive|examples|providers))/ | |
- id: terraform_fmt | |
files: (\.tf|\.tfvars)$ | |
exclude: (.+/\.terraform|^_archive)/ | |
- id: terraform_validate | |
files: (\.tf|\.tfvars)$ | |
exclude: (.+/(\.terraform|examples)|^_(archive|examples|providers|modules))/ | |
- id: terraform_tflint # https://github.com/terraform-linters/tflint/tree/master/docs/rules | |
verbose: true | |
args: | |
- --args=--force # Don't break at warning | |
- --args=--enable-rule=terraform_required_version | |
- --args=--enable-rule=terraform_required_providers | |
- --args=--enable-rule=terraform_module_pinned_source | |
- --args=--enable-rule=terraform_unused_declarations | |
- --args=--enable-rule=terraform_unused_required_providers | |
- --args=--enable-rule=terraform_deprecated_interpolation | |
- --args=--enable-rule=terraform_deprecated_index | |
- --args=--enable-rule=terraform_empty_list_equality | |
files: (\.tf|\.tfvars)$ | |
exclude: (.+/\.terraform|^_archive)/ | |
- id: terraform_docs | |
args: | |
- --hook-config=--add-to-existing-file=true | |
- --hook-config=--create-file-if-not-exist=true | |
- --args=--config=.terraform-docs.yml | |
files: (\.tf|\.terraform\.lock\.hcl)$ | |
exclude: (.+/\.terraform|^_(archive|modules|providers|examples))/ | |
- repo: https://github.com/adrienverge/yamllint.git | |
rev: v1.35.1 | |
hooks: | |
- id: yamllint | |
verbose: true | |
exclude: (.+/(\.terraform|templates)|^_archive)/ # Templating breaks the YAML parser | |
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt | |
rev: 0.2.3 | |
# If this hook gives Python errors, check if the broken file uses templates and if the syntax is correct | |
hooks: | |
- id: yamlfmt | |
args: [--mapping, '2', --sequence, '4', --offset, '2', --preserve-quotes] | |
exclude: (.+/(\.terraform|examples|templates)|^_archive)/ # Templating breaks the YAML parser | |
- repo: https://github.com/bridgecrewio/checkov.git | |
rev: 3.2.321 | |
hooks: | |
- id: checkov | |
exclude: (.+/(\.terraform|examples)|^_(archive|examples|providers))/ | |
- repo: https://github.com/pre-commit/pre-commit-hooks | |
rev: v5.0.0 | |
hooks: | |
- id: trailing-whitespace | |
- id: check-added-large-files | |
- id: end-of-file-fixer | |
- repo: https://github.com/hhatto/autopep8 | |
rev: v2.3.1 | |
hooks: | |
- id: autopep8 | |
------------------------------------------------------------------------------- | |
--- | |
repos: | |
- repo: https://github.com/pre-commit/pre-commit-hooks | |
rev: v4.5.0 | |
hooks: | |
- id: trailing-whitespace | |
- id: end-of-file-fixer | |
# - id: check-yaml | |
- id: check-added-large-files | |
- repo: https://github.com/adrienverge/yamllint | |
rev: v1.35.0 | |
hooks: | |
- id: yamllint | |
args: [ -c=.yamllint ] | |
- repo: https://github.com/antonbabenko/pre-commit-terraform | |
rev: v1.96.0 | |
hooks: | |
# formatter | |
- id: terraform_fmt | |
files: (\.tf|\.tfvars)$ | |
args: | |
- --args=-recursive | |
# - --args=-diff | |
- --args=-write=true | |
- --hook-config=--parallelism-ci-cpu-cores=2 | |
# validate | |
- id: terraform_validate | |
name: terraform validate AWS staging infrastructure | |
files: ^terraform/aws/environment/staging/ | |
args: | |
- --hook-config=--retry-once-with-cleanup=true | |
- --hook-config=--parallelism-ci-cpu-cores=2 | |
- --hook-config=--tf-init-args=-backend=true | |
- --hook-config=--chdir=terraform/aws/environment/staging | |
- id: terraform_validate | |
name: terraform validate AWS production infrastructure | |
files: ^terraform/aws/environment/production/ | |
args: | |
- --hook-config=--retry-once-with-cleanup=true | |
- --hook-config=--parallelism-ci-cpu-cores=2 | |
- --hook-config=--tf-init-args=-backend=true | |
- --hook-config=--chdir=terraform/aws/environment/production | |
- id: terraform_validate | |
name: terraform validate staging DNS | |
files: ^terraform/aws/environment/staging-DNS/ | |
args: | |
- --hook-config=--retry-once-with-cleanup=true | |
- --hook-config=--parallelism-ci-cpu-cores=2 | |
- --hook-config=--tf-init-args=-backend=true | |
- --hook-config=--chdir=terraform/aws/environment/staging-DNS | |
- id: terraform_validate | |
name: terraform validate production DNS | |
files: ^terraform/aws/environment/production-DNS/ | |
args: | |
- --hook-config=--retry-once-with-cleanup=true | |
- --hook-config=--parallelism-ci-cpu-cores=2 | |
- --hook-config=--tf-init-args=-backend=true | |
- --hook-config=--chdir=terraform/aws/environment/production-DNS | |
# linter | |
- id: terraform_tflint | |
name: terraform tflint AWS staging infrastructure | |
files: ^terraform/aws/environment/staging | |
args: | |
- --hook-config=--parallelism-ci-cpu-cores=2 | |
- --args=--enable-rule=terraform_required_version | |
- --args=--enable-rule=terraform_required_providers | |
- --args=--enable-rule=terraform_module_pinned_source | |
- --args=--disable-rule=terraform_unused_declarations | |
- --args=--disable-rule=terraform_unused_required_providers | |
- --args=--enable-rule=terraform_deprecated_interpolation | |
- --args=--enable-rule=terraform_deprecated_index | |
- --args=--enable-rule=terraform_empty_list_equality | |
- --args=--enable-rule=terraform_deprecated_lookup | |
- --args=--enable-rule=terraform_empty_list_equality | |
- --args=--enable-rule=terraform_module_version | |
- --args=--disable-rule=terraform_typed_variables | |
- --hook-config=--chdir=terraform/aws/environment/staging | |
- id: terraform_tflint | |
name: terraform tflint AWS production infrastructure | |
files: ^terraform/aws/environment/production | |
args: | |
- --hook-config=--parallelism-ci-cpu-cores=2 | |
- --args=--enable-rule=terraform_required_version | |
- --args=--enable-rule=terraform_required_providers | |
- --args=--enable-rule=terraform_module_pinned_source | |
- --args=--disable-rule=terraform_unused_declarations | |
- --args=--disable-rule=terraform_unused_required_providers | |
- --args=--enable-rule=terraform_deprecated_interpolation | |
- --args=--enable-rule=terraform_deprecated_index | |
- --args=--enable-rule=terraform_empty_list_equality | |
- --args=--enable-rule=terraform_deprecated_lookup | |
- --args=--enable-rule=terraform_empty_list_equality | |
- --args=--enable-rule=terraform_module_version | |
- --args=--disable-rule=terraform_typed_variables | |
- --hook-config=--chdir=terraform/aws/environment/production | |
- id: terraform_tflint | |
name: terraform tflint staging DNS | |
files: ^terraform/aws/environment/staging-DNS | |
args: | |
- --hook-config=--parallelism-ci-cpu-cores=2 | |
- --args=--enable-rule=terraform_required_version | |
- --args=--enable-rule=terraform_required_providers | |
- --args=--enable-rule=terraform_module_pinned_source | |
- --args=--disable-rule=terraform_unused_declarations | |
- --args=--disable-rule=terraform_unused_required_providers | |
- --args=--enable-rule=terraform_deprecated_interpolation | |
- --args=--enable-rule=terraform_deprecated_index | |
- --args=--enable-rule=terraform_empty_list_equality | |
- --args=--enable-rule=terraform_deprecated_lookup | |
- --args=--enable-rule=terraform_empty_list_equality | |
- --args=--enable-rule=terraform_module_version | |
- --args=--disable-rule=terraform_typed_variables | |
- --hook-config=--chdir=terraform/aws/environment/staging-DNS | |
- id: terraform_tflint | |
name: terraform tflint production DNS | |
files: ^terraform/aws/environment/production-DNS | |
args: | |
- --hook-config=--parallelism-ci-cpu-cores=2 | |
- --args=--enable-rule=terraform_required_version | |
- --args=--enable-rule=terraform_required_providers | |
- --args=--enable-rule=terraform_module_pinned_source | |
- --args=--disable-rule=terraform_unused_declarations | |
- --args=--disable-rule=terraform_unused_required_providers | |
- --args=--enable-rule=terraform_deprecated_interpolation | |
- --args=--enable-rule=terraform_deprecated_index | |
- --args=--enable-rule=terraform_empty_list_equality | |
- --args=--enable-rule=terraform_deprecated_lookup | |
- --args=--enable-rule=terraform_empty_list_equality | |
- --args=--enable-rule=terraform_module_version | |
- --args=--disable-rule=terraform_typed_variables | |
- --hook-config=--chdir=terraform/aws/environment/production-DNS | |
- repo: https://github.com/bridgecrewio/checkov.git | |
name: Checkov check YAML/YML files | |
rev: '' | |
hooks: | |
- id: checkov | |
files: \.y(a)?ml$ | |
# Please install the following pre-commit hooks: | |
# pip install pre-commit yamllint | |
# pre-commit install | |
# Also you can run linter for all files: | |
# pre-commit run --all-files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment