Terraform
Cost estimates API reference
Use the cost estimate API to estimate the cost of your HCP Terraform workspaces.
Show a cost estimate
Note: The hash in the resources attribute structure represents low-level Cost Estimation details. The keys or structure may change over time. Use the data in this hash at your own risk.
GET /cost-estimates/:id
| Parameter | Description |
|---|---|
id | The ID of the cost estimate to show. |
There is no endpoint to list cost estimates. You can find the ID for a cost estimate in the relationships.cost-estimate property of a run object.
| Status | Response | Reason |
|---|---|---|
| 200 | JSON API document (type: "cost-estimates") | The request was successful |
| 404 | JSON API error object | Cost estimate not found, or user unauthorized to perform action |
Sample Request
curl \ --header "Authorization: Bearer $TOKEN" \ https://app.terraform.io/api/v2/cost-estimates/ce-BPvFFrYCqRV6qVBK Sample Response
{ "data": [ { "id": "ce-BPvFFrYCqRV6qVBK", "type": "cost-estimates", "attributes": { "error-message": null, "status": "finished", "status-timestamps": { "queued-at": "2017-11-29T20:02:17+00:00", "finished-at": "2017-11-29T20:02:20+00:00" }, "resources": {...}, "resources-count": 4, "matched-resources-count": 3, "unmatched-resources-count": 1, "prior-monthly-cost": "0.0", "proposed-monthly-cost": "25.488", "delta-monthly-cost": "25.488", }, "links": { "self": "/api/v2/cost-estimate/ce-9VYRc9bpfJEsnwum" } } ] }