mirror of
https://github.com/tofuutils/pre-commit-opentofu.git
synced 2025-10-15 17:38:54 +02:00
feat: Allow env vars expansion in --args section for all hooks (#363)
This commit is contained in:
parent
95ca35646c
commit
caa01c30b3
14 changed files with 68 additions and 0 deletions
19
README.md
19
README.md
|
|
@ -36,6 +36,7 @@ If you are using `pre-commit-terraform` already or want to support its developme
|
|||
* [4. Run](#4-run)
|
||||
* [Available Hooks](#available-hooks)
|
||||
* [Hooks usage notes and examples](#hooks-usage-notes-and-examples)
|
||||
* [All hooks: Usage of environment variables in `--args`](#all-hooks-usage-of-environment-variables-in---args)
|
||||
* [checkov (deprecated) and terraform_checkov](#checkov-deprecated-and-terraform_checkov)
|
||||
* [infracost_breakdown](#infracost_breakdown)
|
||||
* [terraform_docs](#terraform_docs)
|
||||
|
|
@ -238,6 +239,24 @@ Check the [source file](https://github.com/antonbabenko/pre-commit-terraform/blo
|
|||
|
||||
## Hooks usage notes and examples
|
||||
|
||||
### All hooks: Usage of environment variables in `--args`
|
||||
|
||||
> All, except deprecated hooks: `checkov`, `terraform_docs_replace`
|
||||
|
||||
You can use environment variables for the `--args` section.
|
||||
Note: You _must_ use the `${ENV_VAR}` definition, `$ENV_VAR` will not expand.
|
||||
|
||||
Config example:
|
||||
|
||||
```yaml
|
||||
- id: terraform_tflint
|
||||
args:
|
||||
- --args=--config=${CONFIG_NAME}.${CONFIG_EXT}
|
||||
- --args=--module
|
||||
```
|
||||
|
||||
If for config above set up `export CONFIG_NAME=.tflint; export CONFIG_EXT=hcl` before `pre-commit run`, args will be expanded to `--config=.tflint.hcl --module`.
|
||||
|
||||
### checkov (deprecated) and terraform_checkov
|
||||
|
||||
> `checkov` hook is deprecated, please use `terraform_checkov`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue