HashiCorp : Terraform Cloud
Advanced Topics
Lab Solution Cost Estimation
Terraform Cloud Cost Estimation provides real-time insights into the financial impact of your infrastructure-as-code changes. By previewing estimated cost deltas before you apply a plan, you can budget effectively and avoid surprises in your cloud bill.
Prerequisites
Note
Cost Estimation is available in the Team & Governance tier of Terraform Cloud. If you’re not on this tier yet, start a free trial to enable cost forecasting features.
1. Enable Cost Estimation
Navigate to Settings > Plan & Billing in your Terraform Cloud organization to confirm your Team & Governance tier and trial status.
Next, go to Settings > Cost Estimation Integration, enable cost estimation for all workspaces, and click Update Settings.
2. Viewing Cost Estimates
After enabling the feature, open any workspace (for example, MyAppDev) and trigger a plan. The Cost Estimation stage appears immediately after the Terraform plan phase:
Key columns include:
- Hourly Cost: Estimated rate per hour for each resource.
- Monthly Cost: Projected charge over a full month.
- Monthly Delta: Difference between the new monthly cost and the current state.
Resources without pricing data will appear as “cannot estimate cost.”
3. Testing Cost Impact
Modify your Terraform code to see how changes affect cost. For instance, update the EC2 instance type for the Clumsy Bird application from t2.micro
to t2.small
, commit your change, and run a new plan. The Cost Estimation section will highlight the updated delta:
Upgrading from t2.micro to t2.small adds approximately $8.20 per month.
4. Supported Providers
Terraform Cloud Cost Estimation currently supports the following cloud providers:
Provider | Coverage |
---|---|
AWS | EC2, RDS, S3, Lambda, and more |
GCP | Compute Engine, Cloud Storage, and more |
Azure | Virtual Machines, Storage Accounts, and more |
Summary
Terraform Cloud’s Cost Estimation feature empowers teams to monitor and forecast infrastructure expenses before deployment. Enable it in your organization to incorporate cost visibility into your CI/CD workflows.
Links and References
Watch Video
Watch video content
Practice Lab
Practice lab