» Cost Estimation in Terraform Cloud

Hands-on: Try the Control Costs with Policies tutorial on HashiCorp Learn.

Terraform Cloud provides cost estimates for many resources found in your Terraform configuration. For each resource an hourly and monthly cost is shown, along with the monthly delta. The total cost and delta of all estimable resources is also shown.

» Enabling Cost Estimation

To enable cost estimation for your organization, check the box in your organization's settings.

enable cost estimation

» Viewing a Cost Estimate

When enabled, Terraform Cloud performs a cost estimate for every run. Estimated costs appear in the run UI as an extra run phase, between the plan and apply.

The estimate displays a total monthly cost by default; you can expand the estimate to see an itemized list of resource costs, as well as the list of unestimated resources.

Note that this is just an estimate; some resources don't have cost information available or have unpredictable usage-based pricing. Supported resources are listed in this document's sub-pages.

cost estimation run

» Verifying Costs in Policies

You can use a Sentinel policy to validate your configuration's cost estimates using the tfrun import. The example policy below checks that the new cost delta is no more than $100. A new t3.nano instance should be well below that. A decimal import is available for more accurate math when working with currency numbers.

import "tfrun"
import "decimal"

delta_monthly_cost = decimal.new(tfrun.cost_estimate.delta_monthly_cost)

if delta_monthly_cost.greater_than(100) {
    print("This policy prevents a user from increasing their spending by more than $100 per month in a single run without a warning.")

main = rule {

» Supported Resources

Cost estimation in Terraform Cloud supports Terraform resources within three major cloud providers.