BM: Baca dalam Bahasa Melayu
World T3: State & Teams
state list, show and rm
You will learn: how to look inside the register, and why rm only makes OpenTofu forget.
Checked with OpenTofu 1.13 on 1 Nov 2026
The problem
The register holds five things now. The boss asks: “Which table number did we get?” You don’t want to dig through raw JSON. What do you use?
Pick one answer.
Try it
First list everything: tofu state list. Then look at one: tofu state show random_integer.table.
Blueprint (your .tf files)init done
local_file.menulocal_file.signrandom_integer.tablerandom_pet.stallterraform_data.bell
Built (the state file)state #1
local_file.menulocal_file.signrandom_integer.tablerandom_pet.stallterraform_data.bell
Change a file, then run tofu plan to see what it means.
Hint
Copy a name from the list intotofu state show.Check
This is tofu state show local_file.sign. Find what the sign says.
Tap the line with the sign's words.
0 of 1 found
Predict
Now tofu state rm local_file.sign. What happens to sign.txt?
Pick one answer.
Try it
⚠️ Careful: state rm makes OpenTofu forget a real thing. Try it here: tofu state rm local_file.sign. Then tofu plan.
Blueprint (your .tf files)init done
local_file.menulocal_file.signrandom_integer.tablerandom_pet.stallterraform_data.bell
Built (the state file)state #1
local_file.menulocal_file.signrandom_integer.tablerandom_pet.stallterraform_data.bell
Change a file, then run tofu plan to see what it means.
Hint
Plan after rm shows what “forgetting” costs.Check
Sort the commands: do they only read, or do they change the register?
Drag a card into a box. Or tap the card, then tap the box.
You did it!
You can now read the register and know what state rm really does.
Go deeper (optional)
Each state command that changes the register saves a timestamped backup first, like terraform.tfstate.1793491219.backup. The reviewable way to forget a thing is a removed block in the code. OpenTofu 1.13 also has lifecycle { destroy = false }: forget it instead of destroying it.
Real mission
tofu init && tofu applytofu state listtofu state show local_file.<name>tofu state rm local_file.<name> && tofu plan
0 of 4 steps done · Your ticks are saved.
Bahasa Melayu
Daftar kini simpan lima benda. Bos tanya: “Kita dapat meja nombor berapa?” Anda tak mahu korek JSON mentah. Apa yang anda guna?
Mula-mula senaraikan semua: tofu state list. Kemudian lihat satu: tofu state show random_integer.table.
tofu state show.Ini tofu state show local_file.sign. Cari apa yang papan tanda itu tulis.
Sekarang tofu state rm local_file.sign. Apa jadi pada sign.txt?
⚠️ Hati-hati: state rm buat OpenTofu lupa benda sebenar. Cuba di sini: tofu state rm local_file.sign. Kemudian tofu plan.
Susun arahan: hanya membaca, atau mengubah daftar?
Kini anda boleh baca daftar dan tahu apa sebenarnya state rm buat.
You finished this before. Practice is always welcome!
Official docs: tofu state list · tofu state show · tofu state rm · OpenTofu: removed blocks and destroy = false
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?