Sharing an Azure Cost Estimation provider (and the "Cost as a Resource" pattern)

Hi everyone,

I’ve been using the Infracost CLI for a while (and really appreciate it—I’ve even submitted a few PRs in the past). However, I wanted to experiment with a native approach that doesn’t require an external CLI binary.

I wrote terraform-provider-plancost to explore a specific architectural pattern: Treating Cost as a Resource.

The idea is instead of just printing a summary to stdout, this provider models the cost estimation as a logical resource within the Terraform state. This provides two interesting advantages:

  1. Native Diff
    We get Terraform’s visual diff for free. When you modify an Azure VM SKU, the financial impact appears side-by-side with the configuration change:

    ~ resource "plancost_estimate" "this" {
    ~ monthly_cost: "$120.00" -> "$240.00"
    }
    
  2. State-Based Features (e.g., Cost Guardrails)
    Since the cost data is part of the state, we can implement features like Cost Guardrails natively. The provider can block the plan execution if the estimated cost exceeds a defined budget_limit, without needing external policy engines.

I’m curious to hear what you think about this “Cost as a Resource” approach—does it feel cleaner to keep this metadata inside the state, or do you prefer the external CLI approach?

Thanks!