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 threshold for the comment to be added.
Terraform Cloud Run Tasks
See the Run Tasks integration for instructions and the following screenshot for a demo. Run Tasks is a beta Terraform Cloud feature that can be used to integrate Infracost into the Terraform Cloud pipeline directly. This enables Infracost to work with Terraform Cloud natively, meaning you do not need to install/upgrade our CLI into your CI/CD systems.
All of the above CI/CD integrations support also posting the pull request comment to a Slack channel. To enable it, create a Slack Webhook and set its value to the
SLACK_WEBHOOK_URL environment variable.
- Set the
INFRACOST_LOG_LEVELenvironment variable to
debugin case that provides more useful details. For Atlantis, also set
- Check the Terraform version that Infracost is using matches the version you need. Use the
INFRACOST_TERRAFORM_BINARYenvironment variable to change that.
ls -lahin 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.
- 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.