|
| 1 | +repos: |
| 2 | + # Terraform formatting and documentation |
| 3 | + - repo: https://github.com/terraform-docs/terraform-docs |
| 4 | + rev: v0.16.0 |
| 5 | + hooks: |
| 6 | + - id: terraform-docs-go |
| 7 | + name: terraform-docs |
| 8 | + description: Generate terraform documentation |
| 9 | + entry: terraform-docs -c .terraform-docs.yml |
| 10 | + language: golang |
| 11 | + files: ^[^/]*\.tf$ |
| 12 | + exclude: ^\.terraform/.*$ |
| 13 | + args: [--sort-by-required] |
| 14 | + |
| 15 | + # Terraform linting |
| 16 | + - repo: https://github.com/terraform-linters/tflint |
| 17 | + rev: v0.50.3 |
| 18 | + hooks: |
| 19 | + - id: tflint |
| 20 | + name: tflint |
| 21 | + description: Run tflint to check terraform code quality |
| 22 | + entry: tflint |
| 23 | + language: golang |
| 24 | + files: \.tf$ |
| 25 | + exclude: ^\.terraform/.*$ |
| 26 | + |
| 27 | + # General linting and formatting |
| 28 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 29 | + rev: v4.4.0 |
| 30 | + hooks: |
| 31 | + - id: trailing-whitespace |
| 32 | + name: Trim trailing whitespace |
| 33 | + exclude: ^\.terraform/.*$ |
| 34 | + |
| 35 | + - id: end-of-file-fixer |
| 36 | + name: Fix end of file |
| 37 | + exclude: ^\.terraform/.*$ |
| 38 | + |
| 39 | + - id: check-yaml |
| 40 | + name: Check YAML syntax |
| 41 | + args: [--safe] |
| 42 | + exclude: ^\.terraform/.*$ |
| 43 | + |
| 44 | + - id: check-json |
| 45 | + name: Check JSON syntax |
| 46 | + exclude: ^\.terraform/.*$ |
| 47 | + |
| 48 | + - id: check-added-large-files |
| 49 | + name: Check for large files |
| 50 | + args: [--maxkb=1000] |
| 51 | + exclude: ^\.terraform/.*$ |
| 52 | + |
| 53 | + # Detect secrets |
| 54 | + - repo: https://github.com/Yelp/detect-secrets |
| 55 | + rev: v1.4.0 |
| 56 | + hooks: |
| 57 | + - id: detect-secrets |
| 58 | + name: Detect secrets |
| 59 | + args: [--baseline, .secrets.baseline] |
| 60 | + exclude: ^\.terraform/.*$ |
0 commit comments