How do you use Infracost in a PR?
IntermediateProductionTesting and Policy as Code
Answer
Infracost parses the plan or code and posts a cost diff (monthly delta and top changes) as a PR comment. We add a policy: PRs that raise costs beyond a threshold need FinOps approval. It makes cost visible at the time of change instead of on next month's bill.
infracost breakdown --path tfplan.json --format json --out-file infracost.json
More on Testing and Policy as Code
How do you test infrastructure code, and what does the testing pyramid look like?BeginnerWhat does the static-analysis layer catch?BeginnerWhat does tflint do, and how is it configured?BeginnerHow do Checkov and Trivy differ?IntermediateHow does `terraform test` work?BeginnerHow do mock providers work in `terraform test`?Advanced