Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Describe migration instructions from terraform_docs_replace #451

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 32 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ If you are using `pre-commit-terraform` already or want to support its developme
* [All hooks: Usage of environment variables in `--args`](#all-hooks-usage-of-environment-variables-in---args)
* [All hooks: Set env vars inside hook at runtime](#all-hooks-set-env-vars-inside-hook-at-runtime)
* [All hooks: Disable color output](#all-hooks-disable-color-output)
* [checkov (deprecated) and terraform_checkov](#checkov-deprecated-and-terraform_checkov)
* [infracost_breakdown](#infracost_breakdown)
* [terraform_docs](#terraform_docs)
* [terraform_docs_replace (deprecated)](#terraform_docs_replace-deprecated)
* [terraform_fmt](#terraform_fmt)
* [terraform_providers_lock](#terraform_providers_lock)
* [terraform_tflint](#terraform_tflint)
* [terraform_tfsec](#terraform_tfsec)
* [terraform_validate](#terraform_validate)
* [terraform_wrapper_module_for_each](#terraform_wrapper_module_for_each)
* [checkov (deprecated) and terraform\_checkov](#checkov-deprecated-and-terraform_checkov)
* [infracost\_breakdown](#infracost_breakdown)
* [terraform\_docs](#terraform_docs)
* [terraform\_docs\_replace (deprecated)](#terraform_docs_replace-deprecated)
* [terraform\_fmt](#terraform_fmt)
* [terraform\_providers\_lock](#terraform_providers_lock)
* [terraform\_tflint](#terraform_tflint)
* [terraform\_tfsec](#terraform_tfsec)
* [terraform\_validate](#terraform_validate)
* [terraform\_wrapper\_module\_for\_each](#terraform_wrapper_module_for_each)
* [terrascan](#terrascan)
* [tfupdate](#tfupdate)
* [Docker Usage: File Permissions](#docker-usage-file-permissions)
Expand Down Expand Up @@ -498,18 +498,31 @@ Unlike most other hooks, this hook triggers once if there are any changed files

### terraform_docs_replace (deprecated)

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

`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.
`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.
MaxymVlasov marked this conversation as resolved.
Show resolved Hide resolved

Example:
To replicate functionality in `terraform_docs` hook:

```yaml
- id: terraform_docs_replace
args:
- --sort-by-required
- --dest=TEST.md
```
1. Create `.terraform-docs.yml` in the repo root with the next context:
MaxymVlasov marked this conversation as resolved.
Show resolved Hide resolved

```yaml
formatter: "markdown"

output:
file: "README.md"
mode: replace
template: |-
{{/** End of file fixer */}}
```

2. Replace `terraform_docs_replace` hook config in `.pre-commit-config.yaml` with:

```yaml
- id: terraform_docs
args:
- --args=--config=.terraform-docs.yml
```

### terraform_fmt

Expand Down
2 changes: 1 addition & 1 deletion hooks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
print(
'`terraform_docs_replace` hook is DEPRECATED.'
'For details, see https://github.com/antonbabenko/pre-commit-terraform/issues/248'
'For migration instructions, see https://github.com/antonbabenko/pre-commit-terraform/issues/248#issuecomment-1290829226'
MaxymVlasov marked this conversation as resolved.
Show resolved Hide resolved
)