Add to CI/CD
Use one of our many integrations so DevOps, SRE and engineers see a cost estimate in pull requests before making changes. This provides your team with a safety net as people can understand cloud costs upfront, and discuss them as part of your workflow.
Infracost can work with either a Terraform directory or Terraform plan JSON.
Screenshot of Infracost running in GitHub pull requests:

Other CI/CD systems
Infracost can be used in any CI/CD system using the following steps. Our GitLab CI integration follows these steps and has examples that you might find useful.
Use one of the following options to add the Infracost CLI into your CI/CD:
- Docker images
- CLI executable
We maintain specific CI Docker images:
infracost/infracost:ci-0.10 - Recommended, use latest 0.10.x version to pick up bug fixes and new resource costs
infracost/infracost:ci-0.10.x - Lock the version, see versions in https://github.com/infracost/infracost/releases
infracost/infracost:ci-latest - Use latest Infracost image, might break when new minor/major versions are releasedIf your infra code is in GitHub, GitLab and Azure Repos or Bitbucket, run the breakdown, diff and comment commands to generate a cost estimate and post a comment directly.
Otherwise, run the breakdown, diff and output commands to save the comment markdown (e.g. using
--format github-comment
) and post it from your CI/CD system using curl or other command line tools.You might also find the environment variables page useful.
If you run into any issues, please join our community Slack channel, we'll help you very quickly 😄
Third-party integrations
Infracost can also be used alongside many other third-party systems including Terraform Cloud/Enterprise, Env0, Scalr and Spacelift.