Share an Infracost report
Cost review has the same problem as security review: the tool produces
the number, and the decision about the number is made by someone who
never sees the tool. A PR comment saying +$412/mo gets a thumbs-up
because arguing requires context nobody has in that thread.
The context is the breakdown — which resource, at what size, for what reason. That is worth its own link.
Publish it
infracost breakdown --path . \
--format json --out-file infracost.json
infracost output --path infracost.json \
--format html --out-file infracost.html
curl -fsS -X PATCH \
"https://commareports.com/api/v1/reports/$COMMA_REPORT_ID" \
-H "Authorization: Bearer $COMMA_API_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n --rawfile html infracost.html \
--arg title "Cost — $ENVIRONMENT — $(date +%F)" \
'{title: $title, html: $html}')"
Use infracost diff instead of breakdown when the question is what a
change costs rather than what everything costs — usually the more useful
report, and the smaller one.
Use a scoped token with reports:write only, and
keep the report team-visible at most — see the
sharing model.
What the URL changes
- Line-item conversations. "This instance size is for the migration and drops in October" pinned to the resource. See commenting on HTML.
- A cost trend. Revision per run at one URL. See revisions and diffs.
- Finance can read it without a Terraform install or a cloud console login.
- Monthly on a schedule. A routine refreshes it — see monthly compliance digests for the same pattern.
Limits
- HTML body: 5 MB. A breakdown of a very large estate can approach it; publish per workspace or per module.
- Scripts run, sandboxed:
allow-scripts, noallow-same-origin. - 60 requests/minute per token.
Try it
Comma is free — unlimited reports, unlimited commenters, unlimited revision history.
Related
- Terraform plans — the change these costs describe
- KICS · Checkov
- Monthly digests · Publish from CI