docs: Document --terraform-plan-flags usage limitations for infracost (#364)

This commit is contained in:
Maksym Vlasov 2022-04-16 15:51:12 +03:00 committed by GitHub
commit f1822ed810
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -299,7 +299,17 @@ Unlike most other hooks, this hook triggers once if there are any changed files
<!-- markdownlint-disable-next-line no-inline-html -->
</details>
2. (Optionally) Define `cost constrains` the hook should evaluate successfully in order to pass:
2. Note that there can be a maximum of one flag inside `--terraform-plan-flags`. Split into several `--args` to avoid using spaces in `--terraform-plan-flags`. Example of right usage:
```yaml
- id: infracost_breakdown
args:
- --args=--path=./env/dev
- --args=--terraform-plan-flags="-var-file=terraform.tfvars"
- --args=--terraform-plan-flags="-var-file=../terraform.tfvars"
```
3. (Optionally) Define `cost constrains` the hook should evaluate successfully in order to pass:
```yaml
- id: infracost_breakdown
@ -346,7 +356,7 @@ Unlike most other hooks, this hook triggers once if there are any changed files
* `.diffTotalHourlyCost` (for Infracost version 0.9.12 or newer) or `[.projects[].diff.totalMonthlyCost | select (.!=null) | tonumber] | add` (for Infracost older than 0.9.12)
* To disable hook color output, set `PRE_COMMIT_COLOR=never` env var.
3. **Docker usage**. In `docker build` or `docker run` command:
4. **Docker usage**. In `docker build` or `docker run` command:
* You need to provide [Infracost API key](https://www.infracost.io/docs/integrations/environment_variables/#infracost_api_key) via `-e INFRACOST_API_KEY=<your token>`. By default, it is saved in `~/.config/infracost/credentials.yml`
* Set `-e INFRACOST_SKIP_UPDATE_CHECK=true` to [skip the Infracost update check](https://www.infracost.io/docs/integrations/environment_variables/#infracost_skip_update_check) if you use this hook as part of your CI/CD pipeline.