IaC Tools
Beyond Terraform: A Look at Cost Estimation for Pulumi and Azure Bicep
Think cost estimation is just for Terraform? Think again. This article explores the growing world of cost management for other popular IaC tools like Pulumi and Azure Bicep. Discover the tools and techniques available to help you "shift left" on costs, no matter which IaC language you use.
Beyond Terraform: A Look at Cost Estimation for Pulumi and Azure Bicep

While Terraform has long dominated the Infrastructure as Code (IaC) landscape, a diverse ecosystem of tools has emerged. Pulumi, with its use of general-purpose programming languages, and Azure Bicep, with its simplified syntax for Azure resources, have gained significant traction. However, as teams adopt these modern IaC tools, they face the same critical challenge: how to estimate and control cloud costs before deployment.

Cost Estimation in the Pulumi Ecosystem

Pulumi's developer-centric approach, allowing infrastructure to be defined in languages like Python, TypeScript, and Go, opens up unique possibilities for cost management. While the ecosystem is still maturing compared to Terraform's, several solutions are available.

Native Pulumi Cloud Features

Pulumi's own commercial offering, Pulumi Cloud, provides a usage-based pricing model centered around "Pulumi Credits". To help teams forecast these costs, Pulumi provides a cost calculator on its website. While this helps estimate the cost of using the Pulumi platform itself, it doesn't directly estimate the cost of the underlying cloud resources being provisioned.

Emerging Third-Party Tools: Cloudcostify

To fill the gap for pre-deployment cloud resource estimation, dedicated third-party tools are beginning to appear. Cloudcostify is one such tool specifically designed for Pulumi.

  • Core Functionality: Cloudcostify aims to provide cost estimations for deploying cloud resources defined in Pulumi code. Its goal is to prevent costly mistakes by showing the financial impact of changes before they are applied.

  • CI/CD Integration: A key feature is its integration into CI/CD systems like Azure DevOps and GitHub. This allows teams to automatically run cost estimations on every infrastructure code change and even configure a budget to block deployments that would exceed predefined limits.

  • API-Driven Approach: Cloudcostify also plans to offer a Pulumi Cost Estimation REST API and a general Cloud Pricing API, enabling developers to build custom cost estimation solutions.

Infracost's Planned Support

Infracost, a leading cost estimation tool in the Terraform space, has long had plans to expand its support to other IaC tools. Pulumi is frequently mentioned as a target for future integration. Once available, this would bring Infracost's extensive resource coverage and mature FinOps governance features to the Pulumi ecosystem.

Cost Estimation for Azure Bicep

Azure Bicep simplifies the authoring of Azure Resource Manager (ARM) templates with a cleaner syntax. For cost estimation, Bicep users can leverage a combination of native Azure capabilities and open-source tools.

The "What-If" Operation

Azure Resource Manager provides a powerful native feature called the what-if deployment operation. This allows you to preview the changes that will occur if you deploy a Bicep file without actually making any changes.

  • How it Works: When you run a deployment with the what-if flag, ARM compares the desired state in your Bicep file with the current state in Azure and provides a summary of what will be created, modified, or deleted.

  • Limitations for Cost: While the what-if operation is excellent for previewing infrastructure changes, it does not provide a direct cost estimate. It tells you what will change, but not how much it will cost.

Open-Source Tooling: Azure Cost Estimator (ACE)

For automated cost estimation, the open-source tool Azure Cost Estimator (ACE) provides a robust solution that works with Bicep and ARM templates.

  • Core Functionality: ACE is a CLI tool that analyzes your IaC files and calculates the estimated cost by calling the Azure Retail Prices API directly. It's designed to be an integral part of a CI/CD pipeline.

  • Key Features:

    • Native Bicep Support: It seamlessly integrates with Bicep files, handling parameters and modules.

    • Delta Calculation: It can display the difference in cost between your current estimated cost and the cost after proposed changes are applied.

    • CI/CD Guardrails: ACE can be configured to fail a pipeline run if the estimated cost exceeds a specified threshold.

    • GitHub Action: A dedicated GitHub Action is available for easy integration into workflows.

Creating Budgets with Bicep

In addition to pre-deployment estimation, you can use Bicep to codify your FinOps governance by creating Azure Budgets programmatically. Using the Microsoft.CostManagement/budgets resource type, you can define a budget for a specific scope, set an amount, and configure notification alerts.

Conclusion

The landscape for cost estimation outside of the Terraform ecosystem is vibrant and growing. For Pulumi users, emerging tools like Cloudcostify promise to bring dedicated, CI-integrated cost feedback. For Azure Bicep, the combination of the native what-if operation for change validation and the powerful open-source ACE tool for automated cost estimation provides a comprehensive solution. As these modern IaC platforms continue to mature, the availability of their cost management tooling will only increase, making proactive FinOps a reality for all developers.

See, Understand, Optimize -
All in One Place

Atler Pilot decodes your cloud spend story by bringing monitoring, automation, and intelligent insights together for faster and better cloud operations.