Fast
HCL is evaluated statically and in parallel. There are no providers to download and no plans to wait for.
§ 00 Cost estimates for Google Cloud · Terraform & Terragrunt
costerra reads your Terraform and Terragrunt code, prices every resource against the official Cloud Billing
catalog in milliseconds, and marks up the bill with ways to spend less. You don't need
terraform init or any credentials.
cargo install --locked --git https://github.com/echaouchna/costerra
costerra breakdown live/, condensed
Fast, accurate and built for CI. costerra fits into the workflow you already have, from your laptop to the merge request.
HCL is evaluated statically and in parallel. There are no providers to download and no plans to wait for.
Prices come from the Cloud Billing Catalog API. costerra applies sustained use discounts, licenses, GPUs, tiered rates, Spot pricing and regional differences.
costerra detects your billing account and prices with your negotiated discounts. Public list prices stay visible next to them.
saves 19.7% against the list price
Diff costs against any git ref, post Markdown comments on merge requests, and fail the pipeline when a budget policy is broken.
Storage, requests and egress get small, medium and large example estimates when you have no usage data yet.
costerra handles include, dependency outputs, read_terragrunt_config and generate blocks, along with modules, for_each and about 90 built-in functions. If a root module keeps one tfvars file per environment, you get one project per environment.
Your code is evaluated on your machine and nothing is uploaded. The AI review is opt-in. Before it uploads anything, it redacts secrets, skips git-ignored files and honours .costerraignore. A dry run shows exactly what would be sent.
.tf to a priced, annotated report, in one command.Four stations, no network round trips on the critical path. Prices that need refreshing are fetched in parallel while the code is evaluated.
Terraform root modules, Terragrunt units, mixed repositories or a plan.json. costerra discovers the projects for you.
Variables, locals, count and for_each, local and remote modules, and dependency outputs are all evaluated statically and in parallel.
Each resource is matched to its SKUs, with your contract prices when they are available. The catalog is split per service and decoded lazily.
More than 120 rules plus Google Cloud Recommender and Rabbit insights, each with an estimated monthly saving and its source.
Each finding is matched to the Terraform resource it concerns and comes with an estimated monthly saving. Rules that only make sense outside production, such as Spot, single-zone or no HA, are applied only there.
google_compute_instance.app[*] ×2google_compute_instance.app[*] ×41-year or 3-year commitmentgoogle_storage_bucket.datalakegoogle_compute_address.legacyThe total counts the best option per resource, so alternatives for the same VM are never added together. Each line names its source: a costerra rule ID, a ready-to-run gcloud recommender command, or a Rabbit link.
costerra comments on each pull request with the cost diff, then updates that same comment on every push. Policies set the exit code, so a budget can block a merge. diff --base reads the base ref with git archive and never writes to the repository.
Monthly cost will increase by $428.10 (+19.0%), from $2,248.49 to $2,676.59.
legacy-nat −$7.30# abridged: copy the full file from ci/github-actions.yml name: costerra on: pull_request: paths: ["**/*.tf", "**/*.tfvars", "**/*.hcl", "**/costerra*.yml"] permissions: contents: read pull-requests: write jobs: cost: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 with: { fetch-depth: 0 } - name: Estimate run: | costerra pricing sync --if-older-than 7d costerra diff . --base "origin/${BASE_REF}" --format markdown --out costerra.md - name: Comment # creates or updates one PR comment run: gh api … -F body=@costerra.md
include: - remote: https://raw.githubusercontent.com/echaouchna/costerra/main/ci/gitlab-ci.yml # ✓ runs the published container image (pin it with COSTERRA_IMAGE) # ✓ re-downloads prices only when the cache is older than 7 days # ✓ posts, then updates, a single cost comment on the merge request
$ costerra breakdown . --fail-above 10000 $ costerra diff . --base origin/main \ --fail-increase-above 500 --fail-increase-percent 10 ✗ policy violated: monthly cost increase +19.0% exceeds 10% $ echo $? 2 # or in costerra.yml (strict: a typo is an error, never a silent no-op) policies: max_monthly_cost: 50000 max_increase_percent: 15
From Compute Engine to Vertex AI. Run costerra resources to list every supported type and its usage keys.
Prebuilt binaries for Linux and macOS, a small multi-arch container image, or a build from source.
$ cargo install --locked --git https://github.com/echaouchna/costerra
$ docker run --rm -v "$PWD:/work" \
-v "$HOME/.cache/costerra:/home/nonroot/.cache/costerra" \
ghcr.io/echaouchna/costerra breakdown .
# download costerra-<version>-<target>.tar.gz from the releases page, then: $ sha256sum -c SHA256SUMS --ignore-missing $ gh attestation verify costerra-*.tar.gz --repo echaouchna/costerra $ tar xzf costerra-*.tar.gz && mv costerra /usr/local/bin/
costerra pricing syncUses gcloud ADC or COSTERRA_API_KEY. This happens automatically on first run.costerra breakdown path/to/infraWorks on Terraform, Terragrunt or a plan JSON.costerra diff path/to/infra --base origin/mainRun it in CI to get a cost comment on every merge request.costerra is free and open source under Apache-2.0. Run it once on your infrastructure repository and see what you could save.