Skip to content

JamesWoolfenden/pre-commit

 
 

Repository files navigation

pre-commit

Build Status Latest Release pre-commit

After https://github.com/melmorabity/pre-commit-terraform-fmt

Terraform-fmt / Tofu-fmt

A pre-commit hook to rewrite Terraform / OpenTofu configuration files to a canonical format.

The hook auto-detects the binary: it prefers tofu (OpenTofu) if found on PATH, otherwise falls back to terraform. Matches .tf, .tfvars, .tofu and .tofuvars files. Use tofu-fmt or terraform-fmt as the hook id — both run the same implementation.

.pre-commit-config.yaml:

- repo: git://github.com/jameswoolfenden/pre-commit
  rev: 0.0.1
  hooks:
    - id: tofu-fmt
      # Optional: pin a specific binary
      # args: [--terraform=/usr/local/bin/tofu]

Checkov-scan

This runs the Static analysis tool https://www.checkov.io/ for Terraform, the hook automatically installs the Checkov tool.

For Checkov-scan:

- repo: git://github.com/jameswoolfenden/pre-commit
  rev: 0.0.18
  hooks:
    - id: checkov-scan
      files: \.tf$

tf2docs

Updates README.md with Terraform parameters, modules. Requires:

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

The Hook will update in-betweeen with the Terraform-Docs created content. The hook requires that terraform-docs be installed, then add a section to you pre-commit-config.yml, updating to the latest version :

- repo: git://github.com/jameswoolfenden/pre-commit
  rev: 0.0.22
  hooks:
    - id: tf2docs

Contributors

James Woolfenden
James Woolfenden
asottile
asottitle

About

Pre-commit hooks for Terraform tools

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Python 81.4%
  • HCL 18.6%