Skip to main content

Generic CI/CD integration

This page is useful if you cannot use one of our existing CI/CD integration. 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, uses latest patch version of 0.10 to pickup bug fixes and new resources
    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, 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.