Interview Prep/Terraform/Testing and Policy as Code

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
All Terraform questions Roadmap: Terraform in production

More on Testing and Policy as Code