diff --git a/README.md b/README.md index 782e16ebf..1546f0466 100644 --- a/README.md +++ b/README.md @@ -83,43 +83,6 @@ If you want to support the development of `pre-commit-terraform` and [many other ## How to install ### 1. Install dependencies - -* [`pre-commit`](https://pre-commit.com/#install), - [`terraform`](https://www.terraform.io/downloads.html) or [`opentofu`](https://opentofu.org/docs/intro/install/), - [`git`](https://git-scm.com/downloads), - [BASH `3.2.57` or newer](https://www.gnu.org/software/bash/#download), - Internet connection (on first run), - x86_64 or arm64 compatible operating system, - Some hardware where this OS will run, - Electricity for hardware and internet connection, - Some basic physical laws, - Hope that it all will work. -

-* [`checkov`][checkov repo] required for `terraform_checkov` hook -* [`terraform-docs`][terraform-docs repo] 0.12.0+ required for `terraform_docs` hook -* [`terragrunt`][terragrunt repo] required for `terragrunt_validate` and `terragrunt_valid_inputs` hooks -* [`terrascan`][terrascan repo] required for `terrascan` hook -* [`TFLint`][tflint repo] required for `terraform_tflint` hook -* [`TFSec`][tfsec repo] required for `terraform_tfsec` hook -* [`Trivy`][trivy repo] required for `terraform_trivy` hook -* [`infracost`][infracost repo] required for `infracost_breakdown` hook -* [`jq`][jq repo] required for `terraform_validate` with `--retry-once-with-cleanup` flag, and for `infracost_breakdown` hook -* [`tfupdate`][tfupdate repo] required for `tfupdate` hook -* [`hcledit`][hcledit repo] required for `terraform_wrapper_module_for_each` hook - - -#### 1.1 Custom Terraform binaries and OpenTofu support - -It is possible to set custom path to `terraform` binary. -This makes it possible to use [OpenTofu](https://opentofu.org) binary `tofu` instead of `terraform`. - -How binary discovery works and how you can redefine it (first matched takes precedence): - -1. Check if per hook configuration `--hook-config=--tf-path=` is set -2. Check if `PCT_TFPATH=` environment variable is set -3. Check if `TERRAGRUNT_TFPATH=` environment variable is set -4. Check if `terraform` binary can be found in the user's $PATH -5. Check if `tofu` binary can be found in the user's $PATH
Docker
@@ -249,6 +212,47 @@ E.g. `C:\Users\USERNAME\AppData\Local\Programs\Python\Python39\Lib\site-packages
+Full list of dependencies and where they are used: + + +* [`pre-commit`](https://pre-commit.com/#install), + [`terraform`](https://www.terraform.io/downloads.html) or [`opentofu`](https://opentofu.org/docs/intro/install/), + [`git`](https://git-scm.com/downloads), + [BASH `3.2.57` or newer](https://www.gnu.org/software/bash/#download), + Internet connection (on first run), + x86_64 or arm64 compatible operating system, + Some hardware where this OS will run, + Electricity for hardware and internet connection, + Some basic physical laws, + Hope that it all will work. +

+* [`checkov`][checkov repo] required for `terraform_checkov` hook +* [`terraform-docs`][terraform-docs repo] 0.12.0+ required for `terraform_docs` hook +* [`terragrunt`][terragrunt repo] required for `terragrunt_validate` and `terragrunt_valid_inputs` hooks +* [`terrascan`][terrascan repo] required for `terrascan` hook +* [`TFLint`][tflint repo] required for `terraform_tflint` hook +* [`TFSec`][tfsec repo] required for `terraform_tfsec` hook +* [`Trivy`][trivy repo] required for `terraform_trivy` hook +* [`infracost`][infracost repo] required for `infracost_breakdown` hook +* [`jq`][jq repo] required for `terraform_validate` with `--retry-once-with-cleanup` flag, and for `infracost_breakdown` hook +* [`tfupdate`][tfupdate repo] required for `tfupdate` hook +* [`hcledit`][hcledit repo] required for `terraform_wrapper_module_for_each` hook + + +#### 1.1 Custom Terraform binaries and OpenTofu support + +It is possible to set custom path to `terraform` binary. +This makes it possible to use [OpenTofu](https://opentofu.org) binary (`tofu`) instead of `terraform`. + +How binary discovery works and how you can redefine it (first matched takes precedence): + +1. Check if per hook configuration `--hook-config=--tf-path=` is set +2. Check if `PCT_TFPATH=` environment variable is set +3. Check if `TERRAGRUNT_TFPATH=` environment variable is set +4. Check if `terraform` binary can be found in the user's `$PATH` +5. Check if `tofu` binary can be found in the user's `$PATH` + + ### 2. Install the pre-commit hook globally > [!NOTE] @@ -276,6 +280,14 @@ repos: EOF ``` +If this repository was initialized locally via `git init` or `git clone` _before_ +you installed the pre-commit hook globally ([step 2](#2-install-the-pre-commit-hook-globally)), +you will need to run: + +```bash +pre-commit install +``` + ### 4. Run Execute this command to run `pre-commit` on all files in the repository (not only changed files):