CICD-242 · Infrastructure cost estimation
Encyclopedia · Terraform and infrastructure as code · All snippets
Previous · CICD-241 · Next · CICD-243
1. Where it fits
- Placement CI run step.
- Prerequisites trusted Linux runner, Terraform CLI, reviewed IaC and a disposable state for writes.
- Platforms local-linux, github-actions, gitea-actions.
2. Copy the snippet
bash
infracost breakdown --path . --format json --out-file infracost.json
jq -e '.totalMonthlyCost != null' infracost.json3. How it works
The expression filters or transforms the input JSON. Where jq -e is used, a false or empty result can fail the gate.
4. Verify the result
Use an approved cloud pricing integration and authorized credentials. Confirm unsupported resources in the report before relying on totals.
Validation syntax-validated (Bash parse). Status definitions.