Skip to content

Commit a8bcaa7

Browse files
authored
fix: Describe migration instructions from terraform_docs_replace (antonbabenko#451)
1 parent 0e07e28 commit a8bcaa7

File tree

2 files changed

+33
-20
lines changed

2 files changed

+33
-20
lines changed

README.md

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ If you are using `pre-commit-terraform` already or want to support its developme
3939
* [All hooks: Usage of environment variables in `--args`](#all-hooks-usage-of-environment-variables-in---args)
4040
* [All hooks: Set env vars inside hook at runtime](#all-hooks-set-env-vars-inside-hook-at-runtime)
4141
* [All hooks: Disable color output](#all-hooks-disable-color-output)
42-
* [checkov (deprecated) and terraform_checkov](#checkov-deprecated-and-terraform_checkov)
43-
* [infracost_breakdown](#infracost_breakdown)
44-
* [terraform_docs](#terraform_docs)
45-
* [terraform_docs_replace (deprecated)](#terraform_docs_replace-deprecated)
46-
* [terraform_fmt](#terraform_fmt)
47-
* [terraform_providers_lock](#terraform_providers_lock)
48-
* [terraform_tflint](#terraform_tflint)
49-
* [terraform_tfsec](#terraform_tfsec)
50-
* [terraform_validate](#terraform_validate)
51-
* [terraform_wrapper_module_for_each](#terraform_wrapper_module_for_each)
42+
* [checkov (deprecated) and terraform\_checkov](#checkov-deprecated-and-terraform_checkov)
43+
* [infracost\_breakdown](#infracost_breakdown)
44+
* [terraform\_docs](#terraform_docs)
45+
* [terraform\_docs\_replace (deprecated)](#terraform_docs_replace-deprecated)
46+
* [terraform\_fmt](#terraform_fmt)
47+
* [terraform\_providers\_lock](#terraform_providers_lock)
48+
* [terraform\_tflint](#terraform_tflint)
49+
* [terraform\_tfsec](#terraform_tfsec)
50+
* [terraform\_validate](#terraform_validate)
51+
* [terraform\_wrapper\_module\_for\_each](#terraform_wrapper_module_for_each)
5252
* [terrascan](#terrascan)
5353
* [tfupdate](#tfupdate)
5454
* [Docker Usage: File Permissions](#docker-usage-file-permissions)
@@ -498,18 +498,31 @@ Unlike most other hooks, this hook triggers once if there are any changed files
498498

499499
### terraform_docs_replace (deprecated)
500500

501-
**DEPRECATED**. Will be merged in [`terraform_docs`](#terraform_docs). See [#248](https://github.com/antonbabenko/pre-commit-terraform/issues/248) for details.
501+
**DEPRECATED**. Will be merged in [`terraform_docs`](#terraform_docs).
502502

503-
`terraform_docs_replace` replaces the entire README.md rather than doing string replacement between markers. Put your additional documentation at the top of your `main.tf` for it to be pulled in. The optional `--dest` argument lets you change the filename that gets created/modified.
503+
`terraform_docs_replace` replaces the entire `README.md` rather than doing string replacement between markers. Put your additional documentation at the top of your `main.tf` for it to be pulled in.
504504

505-
Example:
505+
To replicate functionality in `terraform_docs` hook:
506506

507-
```yaml
508-
- id: terraform_docs_replace
509-
args:
510-
- --sort-by-required
511-
- --dest=TEST.md
512-
```
507+
1. Create `.terraform-docs.yml` in the repo root with the following content:
508+
509+
```yaml
510+
formatter: "markdown"
511+
512+
output:
513+
file: "README.md"
514+
mode: replace
515+
template: |-
516+
{{/** End of file fixer */}}
517+
```
518+
519+
2. Replace `terraform_docs_replace` hook config in `.pre-commit-config.yaml` with:
520+
521+
```yaml
522+
- id: terraform_docs
523+
args:
524+
- --args=--config=.terraform-docs.yml
525+
```
513526

514527
### terraform_fmt
515528

hooks/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
print(
22
'`terraform_docs_replace` hook is DEPRECATED.'
3-
'For details, see https://github.com/antonbabenko/pre-commit-terraform/issues/248'
3+
'For migration instructions see https://github.com/antonbabenko/pre-commit-terraform/issues/248#issuecomment-1290829226'
44
)

0 commit comments

Comments
 (0)