Skip to content

Pre Deploy Cost Estimates from a Terraform Plan

The cheapest time to find out that a change costs 4000 a month is before you apply it. The Cost Estimate page prices a Terraform plan against AWS list prices and shows what your monthly bill looks like before and after.

Anyone in the organization can run an estimate.

Xplorr reads the JSON form of a Terraform plan:

Terminal window
terraform plan -out plan.out
terraform show -json plan.out > plan.json

Upload plan.json on the Cost Estimate page, or paste its contents, pick a default region, and click Estimate.

A plan pasted here is priced in memory and never stored. To keep an estimate per pull request and compare it with what the resources actually bill, see Pull requests.

  • Monthly change, the difference your plan makes, with how many changes could be priced
  • Before, the current monthly cost of the affected resources
  • After, the monthly cost once applied
  • Resource changes, one row per resource with its address, type, region, action and monthly cost, broken into components such as instance hours and storage
  • Not estimated, the resources Xplorr could not price and why

There is a Copy Markdown button that produces a summary suitable for pasting into a pull request.

This is the most important section on the page. Estimates cover a deliberately small set of resource types, all AWS.

Resource type What is priced
aws_instance Instance hours, plus root and extra EBS volumes
aws_ebs_volume Storage per GB month, plus provisioned IOPS and throughput where they apply
aws_db_instance Instance hours and storage, Single AZ or Multi AZ
aws_nat_gateway Hourly charge
aws_lb and aws_alb Hourly charge, for application, network and gateway load balancers
aws_elasticache_cluster Node hours multiplied by node count

aws_s3_bucket is reported as not estimated on purpose, because S3 cost depends on stored data, storage class and request volume, none of which a plan reveals.

Every other resource type, and every non AWS provider, is listed under Not estimated. Azure and GCP plans are not priced.

The totals cover priced resources only, so treat them as a floor rather than a full bill. Not included:

  • Data transfer and request charges
  • Load balancer capacity units
  • Aurora storage and I/O
  • RDS backup storage beyond the free allowance, and I/O
  • Anything driven by usage rather than by what the plan declares

Other assumptions worth knowing:

  • Prices are AWS on demand list prices in USD, at 730 hours per month. Your negotiated discounts, committed use and Savings Plans are not applied, so real cost is usually lower.
  • EC2 is priced as Linux on shared tenancy unless the plan says otherwise.
  • A root volume whose size comes from the AMI rather than the plan cannot be priced.
  • A resource whose instance type is not known until apply cannot be priced.

The per resource notes on the page call these out individually where they apply, so you can see which rows are affected.

The number that matters is monthly change, not the total. The estimate covers only the resources your plan touches, so the “before” figure is not your bill; it is the current cost of the things about to change.

Because discounts are not applied, a plan that looks affordable at list price will be affordable in practice. The reverse is not true: a plan that looks expensive might still be expensive after discounts.

The example workflow, terraform-cost-estimate.yml (also linked from Cost Estimate → Pull requests → Connect GitHub), plans your Terraform on every pull request, posts the estimate as a comment, and keeps it in Xplorr. Cost Estimate → Pull requests lists the kept estimates, newest first.

Connect GitHub walks through the setup step by step, and the same steps are numbered at the top of the workflow: an Xplorr API token as the secret XPLORR_API_TOKEN, the variable XPLORR_URL, and the credentials Terraform needs to plan. Estimates are kept when the token belongs to a member or admin; a viewer’s token still gets the comment.

  • Each pull request has one estimate. A new commit replaces it, so what is kept is the estimate that merged.
  • When the pull request merges, the workflow’s merged job tells Xplorr.
  • An estimate for a pull request that never merges is deleted after 90 days.

From 7 complete days after the merge, open a pull request to compare its estimate with billing. The comparison is partial until 30 days, then complete. Each resource says how it was matched:

Match How Applies to
Matched resource The planned Name tag finds exactly one resource of that type in that region, first seen after the pull request opened, with its own cost. Actual is its average daily cost since the merge, per month. Created aws_instance, aws_nat_gateway, aws_lb
Service and region The change in that AWS service’s average daily cost in that region after the merge, against the 30 days before. It includes anything else that changed in that service and region, so read it as a guide. RDS, ElastiCache, EBS, and any resource that could not be matched itself
Unmatched Shown with the reason, never dropped. Resources that were not priced or map to no billing service

Give created resources a Name tag. It is how Xplorr finds an instance, NAT gateway or load balancer after apply. Without one, the resource is compared at the service level.

A member sees actual cost only for the cloud accounts they have access to.

  • Up to 2000 resource changes per plan
  • Up to 5 MB of plan JSON
  • 30 requests per 15 minutes per user
  • Very large plans can exceed the request timeout. If that happens, split the plan or estimate a smaller target.

“Plan JSON must be the output of terraform show -json and include resource_changes”

You uploaded the plan file itself or a terraform plan transcript. Xplorr needs the JSON form produced by terraform show -json plan.out.

“That is not valid JSON”

The file was truncated, or the shell redirect captured other output. Regenerate it and check it starts with {.

“No priced resources”

The plan changes nothing Xplorr prices yet. Check the not estimated list to see what it found.

Rows say “No list price found”

Usually an instance type that does not exist in the chosen region, or a region mismatch. Confirm the region and the type.

The estimate looks far higher than my actual bill

Expected. List prices exclude your commitments and discounts. Compare against Commitments to see what you actually pay.

Is my plan stored? A plan pasted on the page is priced in memory and discarded. The pull request workflow keeps the estimate (totals and resources, not the plan) so it can be compared with billing; see Pull requests.

Does this use my AWS credentials? No. Public list prices are used, so no access to your account is involved in pricing.

Does it support Azure or GCP? Not currently. Estimates cover the AWS resource types listed above.

Can I estimate an existing environment rather than a change? This prices a plan. For what you are spending now, use the cost pages.

Do I need to be an admin? No. Anyone in the organization can run an estimate.

  • Commitments for the discounts that make real cost lower than list price
  • Recommendations for reducing the cost of what is already running