Infracost integration

View as Markdown

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.

  1. Sign up at infracost.io and log in to Infracost Cloud.

  2. On first login, create an organization. Keys and run limits belong to the organization.

Image loading...Creating an organization in Infracost Cloud

  1. 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...CLI tokens tab in the Infracost Cloud organization settings

Adding the integration in Buddy

  1. In Buddy, go to the Integrations tab and click New integration.

  2. Select Infracost from the list.

  3. Fill in the form:

  • Name and ID - the name of the integration and its identifier. You enter the identifier in the integration field 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
  1. Click Add a new integration.

Image loading...Infracost integration form with the API key

Buddy stores the CLI token as an encrypted secret and passes it to the action only during execution.

Info
In the Permissions tab, you can configure who can access and use the integration.

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:

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.

Info
All options are described in Cost estimation, and the YAML parameters are in the action reference for Terraform Plan and Terraform Cost Estimation.

Last modified on Nov 25, 2026