BM: Baca dalam Bahasa Melayu
World T4: Modules & Pipelines
Cost checks
You will learn: how a cost check turns a plan into a price change on the pull request.
Checked with OpenTofu 1.13 on 1 Nov 2026
The problem
A one-line change: count = 1 becomes count = 20. The plan says 19 to add. It looks tiny in the diff. Who notices the bill?
Pick one answer.
Try it
Read this plan. Each + is something new to pay for.
Tap what OpenTofu will do to each one.
+ create~ update in place- destroy-/+ replace
0 of 4 read
# random_pet.stall[1] + resource "random_pet" "stall" { + id = (known after apply) + length = 1 + separator = "-" }
What happens to random_pet.stall[1]?
# random_pet.stall[2] + resource "random_pet" "stall" { + id = (known after apply) + length = 1 + separator = "-" }
What happens to random_pet.stall[2]?
# terraform_data.fridge - resource "terraform_data" "fridge" { - id = "1165c449-300a-6d97-cc4b-34a88bc231b8" -> null - input = "old" -> null - output = "old" -> null }
What happens to terraform_data.fridge?
# terraform_data.oven ~ resource "terraform_data" "oven" { id = "74c5fe3d-c127-5269-3f26-b99320430c9f" ~ input = "small" -> "large" ~ output = "small" -> (known after apply) }
What happens to terraform_data.oven?
The summary line shows when you finish.
Watch
A cost check: A check that prices the changes in a plan and shows the monthly difference on the pull request. prices each change in the plan. It posts the monthly difference on the pull request. Sort these changes.
Drag a card into a box. Or tap the card, then tap the box.
Predict
The cost check says: about RM400 more per month. The team rule: over RM100 needs the boss’s OK. What should happen?
Pick one answer.
Check
Put the pull request checks in order.
First at the top. Put these in order. Use the arrows, or drag.
- tofu plan
- tofu fmt -check and validate
- A human reviews it all
- Merge, then apply
- Policy and cost checks read the plan
Check
Swipe: good money habit, or needs work?
Swipe right for good, left for needs work. Or use the buttons.
Tag every resource with an owner, so the bill can be split
You did it!
You can now see the price of a plan before anyone merges it.
Go deeper (optional)
Infracost is a well-known cost tool. It works as a GitHub App, or as a step in CI. It reads the code, looks up public price lists, and comments the monthly change. Usage-based costs, like traffic, need your own guesses. The AWS course (A1) sets up budget alarms.
Bahasa Melayu
Perubahan satu baris: count = 1 jadi count = 20. Plan kata 19 to add. Dalam diff, ia nampak kecil. Siapa perasan bilnya?
Baca plan ini. Setiap + ialah benda baharu yang perlu dibayar.
Semakan kos letak harga pada setiap perubahan dalam plan. Ia tunjuk beza bulanan dalam pull request. Susun perubahan ini.
Semakan kos kata: lebih kurang RM400 lagi sebulan. Peraturan pasukan: lebih RM100 perlukan kelulusan bos. Apa patut berlaku?
Susun semakan pull request mengikut urutan.
Leret: tabiat wang yang bagus, atau perlu dibaiki?
Kini anda boleh nampak harga satu plan sebelum sesiapa merge.
You finished this before. Practice is always welcome!
Official docs: Infracost docs · Infracost: GitHub Actions · tofu plan
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?