Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Infracost

$ infracost Official Low Risk
Infracost · Cloud & Infra · Apache-2.0 · macos / linux / windows

infracost parses Terraform/OpenTofu HCL or plan JSON locally and queries the Infracost Cloud Pricing API to produce monthly cloud cost breakdowns and PR diffs. It provides both --format json and --llm compact output, making it purpose-built for FinOps checks by coding agents.

FCRS-1.0 Score
91 /100
Excellent
Medium Confidence
Zero-Friction Install
brew install infracost
CLI vs MCP Decision CLI Preferred vs MCP

Local HCL parser with native --format json and --llm flags; dramatically faster and more accurate than asking an LLM to guess AWS/GCP/Azure pricing.

Agent-Readiness Checklist

✓ JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
✓ NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 22 / 25

Provides --format json, --json log mode, --llm compact output, and --no-color, though requires an API key (INFRACOST_API_KEY) for pricing lookups.

  • Supports --format json, --json, and --llm output flags
  • Non-interactive execution when INFRACOST_API_KEY is set
Trust & Safety 23 / 25

Read-only static analysis of Terraform/OpenTofu code; only sends anonymized resource pricing queries (no secrets or cloud account IDs) to the pricing API.

  • Zero cloud provider credentials required; read-only local parsing
Setup & Portability 14 / 15

Single Go binary available via Homebrew, Docker, Chocolatey, and GitHub Releases on macOS, Linux, and Windows.

  • Static Go binary across all major platforms
Utility & Efficiency 14 / 15

Replaces error-prone manual pricing calculator lookups with deterministic per-resource cost diffs.

  • Supports AWS, Azure, and GCP resource pricing from HCL or plan JSON
Maintenance & Lineage 9 / 10

Official infracost/infracost project under Apache-2.0 with active maintenance.

  • Official vendor CLI under Apache-2.0
Docs & Verifiability 9 / 10

Well-organized docs covering CLI flags, usage files (infracost-usage.yml), and CI integrations.

  • Detailed CLI reference at infracost.io/docs/

Security, Auth & Guardrails

Auth Modes
Env API Key Config File
Credential Storage

Stores the Cloud Pricing API key in ~/.config/infracost/credentials.yml or reads INFRACOST_API_KEY from the environment.

Side Effects
Read-Only Local Write
Cost & Quotas

CLI is Apache-2.0 open-source; Cloud Pricing API has a generous free tier for individuals and small teams, with paid org plans for CI guardrails.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Infracost Agent Rules
- Ensure `INFRACOST_API_KEY` is configured before running `breakdown` or `diff`.
- Pass `--format json` or `--no-color` when parsing outputs programmatically.
- Treat `infracost breakdown` as read-only cost estimation; never expose API keys in logs.

Agent-Ready Command Recipes

Safe Read-Only Queries

Calculate Terraform directory cost breakdown in JSON
infracost breakdown --path . --format json

Estimates monthly cloud spend from local HCL files and returns structured per-resource cost JSON.

Diff cost impact against baseline JSON
infracost diff --path . --compare-to infracost-base.json --format json

Computes exact monthly cost delta between current code and a saved baseline.

Strengths for Agents

  • + Native --format json and --llm flags tailor output for automated pipelines and agents.
  • + Parses HCL directly without requiring terraform init or cloud credentials.
  • + infracost diff quantifies exact monthly cost deltas before merge.

Caveats & Pitfalls

  • ! Requires INFRACOST_API_KEY (via infracost auth login or env var) to query live pricing data.
  • ! Usage-based resources (egress, Lambda invocations) rely on infracost-usage.yml estimates.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI