Generate reports

The Infracost command's --format table|json|html option can be used to change the output format. The JSON option can be used to generate files that can then be consumed by the infracost report command to generate a combined report. The report command can generate table, JSON or HTML reports.

These reports can be uploaded to object storage such as AWS S3 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.

Run infracost report --help to see the available options.

infracost --terraform-dir /path/to/module1 --format json > module1.json
infracost --terraform-dir /path/to/module2 --format json > module2.json
infracost report --format html module*.json > report.html
Infracost HTML report

Bulk run#

The report_all.sh bash script runs Infracost on all subfolders that have .tf files and outputs the combined results using the infracost report command. You can customize it based on which folders it should exclude or how you run Infracost.