LocalStack LogoLocalStack Icon

Introducing OpenInfraQuote: An Open-Source Terraform Cost Estimation Tool

OpenInfraQuote is a brand-new lightweight, open-source CLI tool for estimating infrastructure costs based upon Terraform plan and state files that can run locally or in CI/CD with no backend, API keys or external integration required.

Introducing OpenInfraQuote: An Open-Source Terraform Cost Estimation Tool

Introduction

As organizations use Infrastructure as Code (IaC) to automate and speed up cloud deployments, it’s easy to overlook the cost of each resource—especially in fast environments with services created quickly across cloud providers. Each IaC change can lead to new or higher costs, and teams often see unexpected bills later. This is where a cost estimation tool becomes critical—it shows expected cloud costs before changes are made, helping teams make informed choices, avoid budget issues, and add cost checks into their development process.

OpenInfraQuote is an open-source CLI tool that reads Terraform plan and state files to estimate cloud infrastructure costs. Created by TerraTeam, with contributions from LocalStack, it adds cost visibility to GitOps or structured workflows. While other tools exist, most are only partly open-source or part of commercial products. OpenInfraQuote is different—it is fully open source and licensed under the Mozilla Public License (MPL).

The tool is intentionally minimal in scope. It doesn’t handle RBAC, policy management, or apply logic. Its only job is to estimate pricing. This focus keeps it simple and maintainable. Here’s how you can use OpenInfraQuote with LocalStack to see a cost breakdown of a sample Terraform configuration before deploying it.

How it works?

The cost-estimation process involves three main inputs:

  1. Terraform Plan/State (in JSON format) – These describe what you’re deploying.
  2. Pricing Sheet (prices.csv) – A file that maps Terraform resources to pricing data.
  3. Usage File (usage.json) – Optional file where you can define usage assumptions, such as request counts for an S3 bucket. This is pre-built into the CLI tool.

The output is a monthly cost estimate for the plan or state file, available in text or JSON format. The CLI tool basically follows a two-step process to calculate this:

  • Matching: Resources from plan/state files are matched against a price sheet (CSV file).
  • Pricing: Matched resources are then priced based on usage patterns and specified parameters.

This separation of concerns makes the tool flexible. For example, if your region isn’t defined in the Terraform files, the tool will default to giving you a min-max price range based on all possible regions. But if you specify a region during pricing, the range will narrow, giving you a more accurate estimate.

How to use it?

Here’s a quick demo showing how to use OpenInfraQuote. We’ll use LocalStack’s tflocal with a sample Terraform configuration and run OpenInfraQuote to generate a monthly cost summary. The tool gives a detailed breakdown by resource, showing each resource’s name, type, cost range, and whether it was added, changed, or deleted.

Install OpenInfraQuote

To install OpenInfraQuote, head over to the GitHub Releases page of the terrateamio/openinfraquote repository. At the time of writing this blog, the latest version is v1.10.0, so we are going to install that.

First, download the binary & extract the archive:

Terminal window
curl -LO https://github.com/terrateamio/openinfraquote/releases/download/v1.10.0/oiq-darwin-amd64-v1.10.0.tar.gz
tar -xzf oiq-darwin-amd64-v1.10.0.tar.gz

Now, move the binary to a directory in your $PATH (e.g., /usr/local/bin), and make sure its executable:

Terminal window
sudo mv oiq /usr/local/bin/
sudo chmod +x /usr/local/bin/oiq

You can now verify the installation:

Terminal window
oiq --help

Download the repository

First, clone the repository that contains the sample Terraform configuration. This configuration deploys an API Gateway that manages sample data using Lambda functions, which connect to an RDS PostgreSQL database through RDS Proxy.

Terminal window
git clone https://github.com/localstack-samples/rds-proxy-terraform-sample

After cloning the repository, navigate to the terraform directory, which contains the Terraform configuration files. Then, initialize the project using tflocal:

Terminal window
cd terraform
tflocal init

Create a Terraform plan

Next, create a Terraform plan file using the following command:

Terminal window
tflocal plan -out=plan

This generates a plan file based on the Terraform configuration. Since this is running locally with LocalStack, the plan is created quickly. Convert the plan to a JSON file using:

Terminal window
tflocal show -json plan > plan.json

OpenInfraQuote uses the JSON output from Terraform plan and state files to ensure stability and consistency in cost estimates.

Estimate the costs

Before running the cost estimation, download the latest pricing sheet using the command below:

Terminal window
curl -s https://oiq.terrateam.io/prices.csv.gz | gunzip > prices.csv

Now, run the cost estimation with the OpenInfraQuote CLI:

Terminal window
oiq match --pricesheet prices.csv plan.json | oiq price --region us-east-1

This will generate output similar to the following:

Match date: 2025-04-04T10:07:47
Price date: 2025-04-04T10:07:47
Match query: not region or (region=us-east-1)
Min Previous Price: 0.00 USD
Max Previous Price: 0.00 USD
Min Price: 100.00 USD
Max Price: 100.00 USD
Min Price Diff: 100.00 USD
Max Price Diff: 100.00 USD
Resources
Name Type Min Price (USD) Max Price (USD) Change
db-setup aws_lambda_function 20.00 20.00 add
delete_dog aws_lambda_function 20.00 20.00 add
get_dog aws_lambda_function 20.00 20.00 add
post_dog aws_lambda_function 20.00 20.00 add
put_dog aws_lambda_function 20.00 20.00 add

The output shows a detailed breakdown for each resource, including the resource name, type, estimated cost range, and whether it was added, changed, or deleted.

In this example, the estimated monthly cost is $100. Since the plan includes only new resources, the difference between the previous and current cost equals the total cost. If changes were made to an existing setup, only the cost of those changes would be reflected.

To get the same output in JSON format, you can run:

Terminal window
oiq match --pricesheet prices.csv plan.json | oiq price --region us-east-1 --format json

This output can be used with tools like Open Policy Agent (OPA) to enforce cost-related policies, such as setting monthly budget limits or restricting specific resource types.

Current Support

OpenInfraQuote currently supports AWS, but full service coverage is still in progress. The roadmap includes future support for GCP, Azure, and any cloud provider with a Terraform provider and an accessible pricing model.

The CLI is open source, and contributions are welcome. You can help in the following ways:

  • Run match on your plan or state files and share the JSON output (after removing any sensitive data).
  • Submit resource mappings for services that are not yet covered.
  • Report bugs and request features to help improve the tool.

Conclusion

OpenInfraQuote is a CLI-first tool designed to be simple and easy to use. There are no API keys to manage, no servers to run, and no data ever leaves your machine. It works with any Terraform wrapper—OpenTofu or Terragrunt—as long as you have access to the plan or state files. Adding support for new resources is as simple as updating a CSV pricing sheet.

Its lightweight and fast design makes it ideal for privacy-focused teams and fast local development. With LocalStack, generating plan and state files for testing is quick and cost-free, making it easy to integrate cost estimation into your workflow.

Together, OpenInfraQuote and LocalStack help teams build, test, and optimize cloud infrastructure with more confidence and control. Want to see it in action? Watch the video below!


Malcolm Matalka
Malcolm Matalka
Co-founder and CTO of Terrateam
Malcolm, with a career spanning more than 20 years, has built developer tooling at companies small and large. He co-founded Terrateam with the goal of bringing high-quality, open source, software to the DevOps world. In is free-time, Malcolm enjoys sailing and in 2024 completed his first trans-Atlantic sail, from the Caribbean to Portugal.
Harsh Mishra
Harsh Mishra
Engineer at LocalStack
Harsh Mishra is an Engineer at LocalStack and AWS Community Builder. Harsh has previously worked at HackerRank, Red Hat, and Quansight, and specialized in DevOps, Platform Engineering, and CI/CD pipelines.