Infracost integration
What is Infracost?
Infracost estimates resource costs from Terraform and OpenTofu plans using pricing data from AWS, Azure, and Google Cloud. It calculates the estimated monthly infrastructure cost before and after the planned changes.
The Infracost integration enables cost estimation in the Terraform Plan, Terraform Drift Detection, and Terraform Cost Estimation actions. The run displays estimated resource costs and exports cost totals as variables for use in trigger conditions, approval conditions, and notifications.
Obtaining an Infracost CLI token
Buddy needs a CLI token from Infracost Cloud. Infracost issues this token for the CLI and for CI/CD integrations.
Sign up at infracost.io and log in to Infracost Cloud.
On first login, create an organization. Keys and run limits belong to the organization.
Image loading...
- Open Org settings and go to CLI tokens. Copy the token from the CLI v0.1 token section or create a new token in the CLI v2 tokens section. Buddy supports both token versions.
Image loading...
Adding the integration in Buddy
In Buddy, go to the Integrations tab and click New integration.
Select Infracost from the list.
Fill in the form:
- Name and ID - the name of the integration and its identifier. You enter the identifier in the
integrationfield in YAML - Scope - whether the integration is available in the whole Workspace, in one Project, or in a selected Environment
- API key - the CLI token from Infracost Cloud
- Click Add a new integration.
Image loading...
Buddy stores the CLI token as an encrypted secret and passes it to the action only during execution.
Cost estimation in a pipeline
In the Terraform Plan or Terraform Drift Detection action, on the Run tab, select Cost estimation and choose the integration. You can also add a separate Terraform Cost Estimation action. In YAML:
- action: Plan
type: TERRAFORM_PLAN
tool: OPENTOFU
version: 1.12.6
working_directory: infra
cost_estimation:
enabled: true
integration: infracost
Each action with cost estimation enabled counts toward the Infracost organization's CI/CD run limit, including actions executed in pull request runs.
Last modified on Nov 25, 2026