Generate reports

The infracost breakdown command has a --format json|table|html flag that can be used to change the output format. The JSON option can be used to generate files from individual projects that can then be consumed by the infracost output command to generate a combined report. The output command has a --format json|diff|table|html flag that sets the report format.

These reports can be uploaded to object storage such as AWS S3 or Google Cloud Storage and shared with others including team members or management. The HTML report also includes the file names and Terraform tags from the files that were used to generate it.

Usage#

Run infracost output --help to see the available options. Example usage:

infracost breakdown --path /path/to/project1 --format json > project1.json
infracost breakdown --path /path/to/project2 --format json > project2.json
infracost output --path project*.json --format html > report.html
infracost output --path project*.json --format diff

Examples#

Infracost HTML report

Bulk run#

The following bash scripts run Infracost on all subfolders that have .tf files and output the combined results using the infracost output command. You can customize them based on which folders they should exclude or how you run Infracost (e.g. pass --terraform-plan-flags).