Infracost is a cost estimation tool for infrastructure as code platforms. Scalr integrates with the Infracost cloud pricing server to provide estimated costs after analyzing the Terraform or OpenTofu plans.

The estimated cost is included in the tfrun input that is sent to the Open Policy Agent integration allowing teams to create policies to review estimated cost.

  "tfrun": {
    "cost_estimate": {
      "prior_monthly_cost": 0.0,
      "proposed_monthly_cost": 5.034,
      "delta_monthly_cost": 5.034

See an OPA policy for managing cost here.

Enable Infracost

To enable the integration, go to the account scope, and integrations, and click on Infracost. Then sign up for Infracost and past the key in:

Once the key is added, click Test connection. After the connection is successfully tested, click create connection.

Once saved, you can control which environments have access to the integration by clicking on the integration and going to Environments access: