Skip to main content

Add to CI/CD

Use one of our many integrations so your engineering team can see cost estimates 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.



Screenshot of Infracost running in GitHub pull requests, the same can be done with GitLab, Azure Repos and Bitbucket:

Infracost pull request comment

Other CI/CD systems

Infracost can be used in any CI/CD system using the following steps. Follow our GitLab CI integration to see examples of how the following steps are used.

  1. Use one of the following options to add the Infracost CLI into your CI/CD:

    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 released
  2. If 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 should also set the required environment variables.

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.