Skip to content

Commit cdfa904

Browse files
committed
docs: Add missed step for init'ed repos and resolve confusion that deps
should be find out and installed manually
1 parent 86557c2 commit cdfa904

File tree

1 file changed

+49
-37
lines changed

1 file changed

+49
-37
lines changed

README.md

Lines changed: 49 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -83,43 +83,6 @@ If you want to support the development of `pre-commit-terraform` and [many other
8383
## How to install
8484

8585
### 1. Install dependencies
86-
<!-- (Do not remove html tags here) -->
87-
* [`pre-commit`](https://pre-commit.com/#install),
88-
<sub><sup>[`terraform`](https://www.terraform.io/downloads.html) or [`opentofu`](https://opentofu.org/docs/intro/install/),
89-
<sub><sup>[`git`](https://git-scm.com/downloads),
90-
<sub><sup>[BASH `3.2.57` or newer](https://www.gnu.org/software/bash/#download),
91-
<sub><sup>Internet connection (on first run),
92-
<sub><sup>x86_64 or arm64 compatible operating system,
93-
<sub><sup>Some hardware where this OS will run,
94-
<sub><sup>Electricity for hardware and internet connection,
95-
<sub><sup>Some basic physical laws,
96-
<sub><sup>Hope that it all will work.
97-
</sup></sub></sup></sub></sup></sub></sup></sub></sup></sub></sup></sub></sup></sub></sup></sub></sup></sub><br><br>
98-
* [`checkov`][checkov repo] required for `terraform_checkov` hook
99-
* [`terraform-docs`][terraform-docs repo] 0.12.0+ required for `terraform_docs` hook
100-
* [`terragrunt`][terragrunt repo] required for `terragrunt_validate` and `terragrunt_valid_inputs` hooks
101-
* [`terrascan`][terrascan repo] required for `terrascan` hook
102-
* [`TFLint`][tflint repo] required for `terraform_tflint` hook
103-
* [`TFSec`][tfsec repo] required for `terraform_tfsec` hook
104-
* [`Trivy`][trivy repo] required for `terraform_trivy` hook
105-
* [`infracost`][infracost repo] required for `infracost_breakdown` hook
106-
* [`jq`][jq repo] required for `terraform_validate` with `--retry-once-with-cleanup` flag, and for `infracost_breakdown` hook
107-
* [`tfupdate`][tfupdate repo] required for `tfupdate` hook
108-
* [`hcledit`][hcledit repo] required for `terraform_wrapper_module_for_each` hook
109-
110-
111-
#### 1.1 Custom Terraform binaries and OpenTofu support
112-
113-
It is possible to set custom path to `terraform` binary.
114-
This makes it possible to use [OpenTofu](https://opentofu.org) binary `tofu` instead of `terraform`.
115-
116-
How binary discovery works and how you can redefine it (first matched takes precedence):
117-
118-
1. Check if per hook configuration `--hook-config=--tf-path=<path_to_binary_or_binary_name>` is set
119-
2. Check if `PCT_TFPATH=<path_to_binary_or_binary_name>` environment variable is set
120-
3. Check if `TERRAGRUNT_TFPATH=<path_to_binary_or_binary_name>` environment variable is set
121-
4. Check if `terraform` binary can be found in the user's $PATH
122-
5. Check if `tofu` binary can be found in the user's $PATH
12386

12487
<details><summary><b>Docker</b></summary><br>
12588

@@ -249,6 +212,47 @@ E.g. `C:\Users\USERNAME\AppData\Local\Programs\Python\Python39\Lib\site-packages
249212

250213
</details>
251214

215+
Full list of dependencies and where they used:
216+
217+
<!-- (Do not remove html tags here) -->
218+
* [`pre-commit`](https://pre-commit.com/#install),
219+
<sub><sup>[`terraform`](https://www.terraform.io/downloads.html) or [`opentofu`](https://opentofu.org/docs/intro/install/),
220+
<sub><sup>[`git`](https://git-scm.com/downloads),
221+
<sub><sup>[BASH `3.2.57` or newer](https://www.gnu.org/software/bash/#download),
222+
<sub><sup>Internet connection (on first run),
223+
<sub><sup>x86_64 or arm64 compatible operating system,
224+
<sub><sup>Some hardware where this OS will run,
225+
<sub><sup>Electricity for hardware and internet connection,
226+
<sub><sup>Some basic physical laws,
227+
<sub><sup>Hope that it all will work.
228+
</sup></sub></sup></sub></sup></sub></sup></sub></sup></sub></sup></sub></sup></sub></sup></sub></sup></sub><br><br>
229+
* [`checkov`][checkov repo] required for `terraform_checkov` hook
230+
* [`terraform-docs`][terraform-docs repo] 0.12.0+ required for `terraform_docs` hook
231+
* [`terragrunt`][terragrunt repo] required for `terragrunt_validate` and `terragrunt_valid_inputs` hooks
232+
* [`terrascan`][terrascan repo] required for `terrascan` hook
233+
* [`TFLint`][tflint repo] required for `terraform_tflint` hook
234+
* [`TFSec`][tfsec repo] required for `terraform_tfsec` hook
235+
* [`Trivy`][trivy repo] required for `terraform_trivy` hook
236+
* [`infracost`][infracost repo] required for `infracost_breakdown` hook
237+
* [`jq`][jq repo] required for `terraform_validate` with `--retry-once-with-cleanup` flag, and for `infracost_breakdown` hook
238+
* [`tfupdate`][tfupdate repo] required for `tfupdate` hook
239+
* [`hcledit`][hcledit repo] required for `terraform_wrapper_module_for_each` hook
240+
241+
242+
#### 1.1 Custom Terraform binaries and OpenTofu support
243+
244+
It is possible to set custom path to `terraform` binary.
245+
This makes it possible to use [OpenTofu](https://opentofu.org) binary `tofu` instead of `terraform`.
246+
247+
How binary discovery works and how you can redefine it (first matched takes precedence):
248+
249+
1. Check if per hook configuration `--hook-config=--tf-path=<path_to_binary_or_binary_name>` is set
250+
2. Check if `PCT_TFPATH=<path_to_binary_or_binary_name>` environment variable is set
251+
3. Check if `TERRAGRUNT_TFPATH=<path_to_binary_or_binary_name>` environment variable is set
252+
4. Check if `terraform` binary can be found in the user's $PATH
253+
5. Check if `tofu` binary can be found in the user's $PATH
254+
255+
252256
### 2. Install the pre-commit hook globally
253257

254258
> [!NOTE]
@@ -276,6 +280,14 @@ repos:
276280
EOF
277281
```
278282

283+
If this repository was initialized locally via `git init` or `git clone` _before_
284+
you installed the pre-commit hook globally ([step 2]((#2-install-the-pre-commit-hook-globally))),
285+
you will need to run:
286+
287+
```bash
288+
pre-commit install
289+
```
290+
279291
### 4. Run
280292

281293
Execute this command to run `pre-commit` on all files in the repository (not only changed files):

0 commit comments

Comments
 (0)