Atlantis Terraform cost estimation: add cost to your PR workflow
Atlantis already plans on every PR — add a post-plan workflow step that estimates cost and comments it, with a budget gate that blocks apply. Reuses the existing plan, works self-hosted and air-gapped.
Quick answer
Atlantis already runs terraform plan on every PR, so add a custom post-plan workflow step that runs C3X against the generated plan and posts the monthly cost as a PR comment — and fail the step on a budget breach to block apply. It reuses the existing plan (accurate, resolved values), works self-hosted and air-gapped, and adds no extra Terraform runs.
If you run Atlantis, you already have the hard part of cost estimation solved: a terraform plan on every pull request, with the output commented inline. Adding cost is a small workflow step that turns that plan into a dollar figure reviewers see next to the diff.
The integration point: custom workflow steps
Atlantis lets you define custom steps in the plan and apply workflows. The recipe is a post-plan step that converts the plan to JSON and estimates it:
# atlantis.yaml
workflows:
default:
plan:
steps:
- init
- plan
- run: terraform show -json $PLANFILE > plan.json
- run: c3x estimate --plan plan.json --budget 2000The estimate prints into the plan output Atlantis comments on the PR, and the --budget flag makes the step fail when the monthly cost exceeds the threshold.
Block apply on budget breach
Because the cost check lives in the plan workflow, a budget breach fails the workflow — so the change can't reach apply until the cost is reviewed. Combined with Atlantis's approval requirements, that gives you the same enforcement as the budget-guardrail pattern, native to your Atlantis flow.
Reuse the plan, stay accurate
Don't generate a separate plan for cost — reuse the one Atlantis already made. Feeding the existing plan JSON to the estimator keeps values resolved (accurate) and adds zero extra Terraform runs.
Self-hosted and air-gapped
Atlantis is self-hosted, and C3X is a single binary that runs in the same environment. For regulated or air-gapped setups, C3X can use an offline pricing snapshot so the cost step needs no outbound network — see air-gapped estimation.
FAQ
Can I add cost estimation to Atlantis?
Yes. Atlantis already runs `terraform plan` on every pull request, so you add a custom workflow step that runs a cost estimator against the generated plan and posts the result as a PR comment. The cost shows up alongside the plan output Atlantis already comments, with no separate tool for reviewers to check.
How does cost estimation fit Atlantis's workflow?
Atlantis workflows let you define custom steps around plan and apply. Add a post-plan step that converts the plan to JSON and runs the estimator, appending the monthly cost to the PR. You can also fail the plan step on a budget breach so apply is blocked until the cost is reviewed.
Can Atlantis block an apply if the cost is too high?
Yes. Because the cost step runs in the plan workflow, having it exit non-zero on a budget breach stops the workflow, so the change can't be applied until someone addresses the cost. Combined with Atlantis's approval requirements, that's a strong cost guardrail.
Do I need a separate plan for the cost step?
No — reuse the plan Atlantis already produces. Convert it with `terraform show -json` in the workflow step and feed that to the estimator. Using the existing plan keeps the estimate accurate (resolved values) and adds no extra Terraform runs.
Does this work with self-hosted Atlantis?
Yes. Atlantis is self-hosted by design, and the cost estimator runs as a binary in the same environment as your Terraform. For air-gapped setups, the estimator can use an offline pricing snapshot so the cost step needs no outbound network.
How does C3X integrate with Atlantis?
Add a custom workflow step that runs `c3x estimate --plan` on the Atlantis-generated plan and posts the cost to the PR, optionally with a budget threshold that fails the workflow. C3X is a single binary, so it drops into the Atlantis server or container easily.
What to do next
Add the post-plan step to your atlantis.yaml and every PR gets a cost estimate plus an optional budget gate. The CI/CD guide covers the workflow details, and the quickstart gets you a local estimate first.
Share this post
Try C3X on your own Terraform
Free and open source. No API key required. One command to install, one command to estimate.