v0.9 migration guide

Once you've installed Infracost v0.9, follow this page to migrate. If you encounter any issues while migrating, please report them and we'll address them as soon as possible.

What's new?#

🚀 We added support for Microsoft Azure! We also updated our JSON output format in Infracost v0.9.0. Finally, we removed commands, flags and environment variables that were marked as deprecated in v0.8.0.

Migration guide#

JSON output#

The JSON output from infracost breakdown --path=path/to/code --format json has been changed to the following format:

  • version has been bumped from v0.1 to v0.2.
  • projects[*].path has moved to projects[*].metadata.path and a new projects[*].name key has been introduced. This name is autogenerated from your code repository URL or the path you pass to Infracost. This enables you to see details of the project that was used to generate the cost estimate.
  • The deprecated top-level resources key has been removed as they are now scoped by project.
{
"version": "0.2",
"timeGenerated": "2021-05-31T18:02:49.412164+01:00",
"projects": [
{
"name": "org/repo/subpath (stage)",
"metadata": {
"path": "path/to/code",
"terraformWorkspace": "stage",
},
"pastBreakdown": {
"resources": [...],
"totalMonthlyCost": "730",
"totalHourlyCost": "1"
},
"breakdown": {
"resources": [...],
"totalMonthlyCost": "1460",
"totalHourlyCost": "1"
},
"diff": {
"resources": [...],
"totalMonthlyCost": "730",
"totalHourlyCost": "1"
}
}
],
"totalMonthlyCost": "2920",
"totalHourlyCost": "4",
"summary": {
"unsupportedResourceCounts": {...}
},
}

Deprecated functionality that has now been removed#

Root command#

The deprecated root infracost command has been removed as we've moved to using subcommands:

  • infracost breakdown: this works similarly to the previous infracost root command and shows a table breakdown of all resources by default. Run infracost breakdown --help to see the other options.
  • infracost diff: this shows a list of the resources along with costs that will change when the Terraform plan is applied.

Report command#

The deprecated infracost report command has been removed and replaced with infracost output.

This takes Infracost JSON files as inputs via --path and allows them to be combined and outputted in any format using --format json|diff|table|html. This command can be used with wildcards too, e.g. infracost output --format html --path infracost*.json > output.html. Run infracost output --help to see the other options.

Flags#

The following deprecated flags have all been removed and replaced with --path:

  • --terraform-dir / --tfdir
  • --terraform-json-file / --tfjson
  • --terraform-plan-file / --tfplan

The --output/ -o flag has been replaced with --format.

Environment variables#

The following deprecated environment variables have been removed:

  • TERRAFORM_BINARY: replaced with INFRACOST_TERRAFORM_BINARY
  • TERRAFORM_CLOUD_HOST: replaced with INFRACOST_TERRAFORM_CLOUD_HOST
  • TERRAFORM_CLOUD_TOKEN: replaced with INFRACOST_TERRAFORM_CLOUD_TOKEN
  • SKIP_UPDATE_CHECK: replaced with INFRACOST_SKIP_UPDATE_CHECK

CI/CD integrations#

No changes are required for any CI/CD integrations.