CI/CD integrations

Infracost CI/CD integrations can be used to automatically add a pull request comment showing the diff of monthly costs between the current and planned state. Minor cost increase/decrease changes can be ignored by setting a percentage threshold for the comment to be added.

Infracost can be used in any CI/CD system using the infracost binary or the infracost/infracost Docker image. You might also find our CI diff script useful; it's used in the following integrations.

GitHub Action#

See the Infracost GitHub Action for instructions, and a demo here.

Example Infracost diff output

GitLab CI#

See the Infracost GitLab CI template for instructions, and a demo here.

Example Infracost diff output

CircleCI#

See the Infracost CircleCI Orb for instructions; it supports GitHub and Bitbucket. A demo of the GitHub integration is here, and Bitbucket is here

Bitbucket Pipelines#

See the Infracost Bitbucket Pipeline for instructions, and a demo here.

Example Infracost diff output

Atlantis#

See the Infracost Atlantis integration for instructions. There is a demo here, expand the Show Output sections and scroll down to see the Infracost output.

Example Infracost diff output

Jenkins#

See the Infracost Jenkins integration for instructions, and a demo here.

Example Infracost diff output

Azure DevOps#

See the Infracost Azure DevOps integration for instructions. A demo of the Azure DevOps Repos (git) integration is here, and GitHub repos is here.

Example Infracost diff output

CI/CD troubleshooting#

Please try the following steps and if that doesn't help, create an issue or join our community Slack channel to chat with us.

  1. Set the INFRACOST_LOG_LEVEL environment variable to debug in case that provides more useful details. For Atlantis, also set atlantis_debug=true.
  2. Check the Terraform version that Infracost is using matches the version you need. Use the INFRACOST_TERRAFORM_BINARY environment variable to change that.
  3. Use ls -lah in the CI build to check for any .terraform* files/folders that might be confusing Terraform running in CI vs previous runs that were used to create them. Removing those files might help.
  4. Check the Terraform Cloud/Enterprise or Terragrunt docs pages if applicable.

My CI/CD isn't supported#

Please create an issue; we'll try to prioritize it depending on the community feedback. There is already a request for BuildKite. Please 👍 it if you'd like us to work on them sooner. You can also join our community Slack channel if you like to work on an integration, the existing integrations can act as a blueprint.

Please email hello@infracost.io if you'd like to discuss integrations with GitHub Enterprise, GitLab Enterprise Edition, or Bitbucket Data Center.