mirror of
https://github.com/tofuutils/pre-commit-opentofu.git
synced 2025-10-15 17:38:54 +02:00
feat: Add __GIT_WORKING_DIR__ to terraform_checkov (#399)
This commit is contained in:
parent
1be6f0218d
commit
ae88ed73cf
2 changed files with 13 additions and 2 deletions
|
|
@ -310,6 +310,14 @@ For deprecated hook you need to specify each argument separately:
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
2. When you have multiple directories and want to run `terraform_checkov` in all of them and share a single config file - use the `__GIT_WORKING_DIR__` placeholder. It will be replaced by `terraform_checkov` hooks with Git working directory (repo root) at run time. For example:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- id: terraform_checkov
|
||||||
|
args:
|
||||||
|
- --args=--config-file __GIT_WORKING_DIR__/.checkov.yml
|
||||||
|
```
|
||||||
|
|
||||||
### infracost_breakdown
|
### infracost_breakdown
|
||||||
|
|
||||||
`infracost_breakdown` executes `infracost breakdown` command and compare the estimated costs with those specified in the hook-config. `infracost breakdown` parses Terraform HCL code, and calls Infracost Cloud Pricing API (remote version or [self-hosted version](https://www.infracost.io/docs/cloud_pricing_api/self_hosted)).
|
`infracost_breakdown` executes `infracost breakdown` command and compare the estimated costs with those specified in the hook-config. `infracost breakdown` parses Terraform HCL code, and calls Infracost Cloud Pricing API (remote version or [self-hosted version](https://www.infracost.io/docs/cloud_pricing_api/self_hosted)).
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,11 @@ function main {
|
||||||
common::initialize "$SCRIPT_DIR"
|
common::initialize "$SCRIPT_DIR"
|
||||||
common::parse_cmdline "$@"
|
common::parse_cmdline "$@"
|
||||||
common::parse_and_export_env_vars
|
common::parse_and_export_env_vars
|
||||||
# shellcheck disable=SC2153 # False positive
|
# Support for setting PATH to repo root.
|
||||||
common::per_dir_hook "${ARGS[*]}" "$HOOK_ID" "${FILES[@]}"
|
# shellcheck disable=SC2178 # It's the simplest syntax for that case
|
||||||
|
ARGS=${ARGS[*]/__GIT_WORKING_DIR__/$(pwd)\/}
|
||||||
|
# shellcheck disable=SC2128 # It's the simplest syntax for that case
|
||||||
|
common::per_dir_hook "$ARGS" "$HOOK_ID" "${FILES[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue