# Cost Estimation
Cost estimation is a feature that enables the estimation of any Terraform-defined infrastructure. This allows organizations to keep track of any impact that a change to infrastructure could have on finances. It is leveraging Cycloid's open-source project (opens new window) that can be audited, contributed to, and quickly integrated with any form or pipeline that uses Terraform.
# Provider support
At the moment, the cost estimation feature only supports a limited number of AWS resources. This is changing quickly as we're adding support for more resources and providers. Please see the detailed list of supported resources (opens new window) for more information.
# Testing with CLI
Using the Cycloid CLI (opens new window) is the easiest way to get started. The costs of any valid Terraform plan (opens new window) can be estimated using the terracost estimate
subcommand:
$ terraform plan -out=./plan; terraform show -json ./plan > plan.json
$ cy terracost estimate --plan-path plan.json
PLANNEDCOST PRIORCOST RESOURCEESTIMATES
71.71 53.24 3
2
3
4
5
# While configuring a project
When using the forms view (opens new window) you are able to access an estimation of the current stack you are configuring. To do so, fill all the required variables and click "Estimate cost" on the right side.
If any estimation was possible, it will then give you its output:
Here you will also be able to dig into the details of that estimation, to see which parts represent each component or which got ignored:
If you happened to change anything related to the project, you'll have to refresh the estimation just like you did the initial one:
At the end of the configuration, you will also have access to a summary of the overall estimation/change.
# In the Cycloid pipeline
In the context of the pipeline, you can use the Cycloid Concourse Resource (opens new window) that can be easily plugged in right after a terraform plan
step and just before a notification mechanism. After configuring the resource, the cost estimation can be performed by specifying feature: terracost
as parameter, for example:
resource_types:
- name: cycloid-resource
type: docker-image
source:
repository: cycloid/cycloid-resource
tag: latest
resources:
# Terracost resource
- name: terracost
type: cycloid-resource
source:
feature: terracost
api_key: <api-key>
env: ((env))
org: ((org))
project: ((project))
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Then in your jobs section:
- put: tfstate
get_params:
output_planfile: true
- put: terracost
params:
tfplan_path: tfstate/plan.json
2
3
4
5
6
7
# Example of output
# Frequently Asked Questions
# Can I use Cost-estimation with a tfstate or a directory of IaC files?
No. Currently, only Terraform plan files in JSON format are supported.
# There is no provider/resource that I need.
We're constantly adding support for more resources, as well as providers besides AWS. TerraCost is an open-source project so consider contributing to it (opens new window).
# Can I use Cost-estimation output in an InfraPolicy?
No, but this option is coming soon.
← Credentials Api Keys →