We recommend that you create an
infracost.yml file in each of your terraform project repos using this example. This file can be passed to Infracost using the
--config-file option. This flag should not be confused with the
--usage-file option that is used to define resource usage estimates.
Using a configuration file has many advantages over CLI flags:
- Not having to remember/specify flags for each run
- Specify multiple terraform directories, JSON/plan files and combine them into a single output
- Specify multiple output formats per run, for example output the table format to the screen and save an HTML report
In the future, we plan to extend the config file so you can select the output columns, level of detail, and breakdown levels (module, project). We might also enable you to specify wildcards to process all projects under a specific directory.
This infracost-example.yml contains the list of all of the available parameters and their descriptions.
Configuration values are chosen in this order:
- CLI flags (run
infracost --helpto see them)
- Environment variables
- Configuration file