BM: Baca dalam Bahasa Melayu
World T3: State & Teams
Remote state backends
You will learn: where a team keeps one shared register, and how to move it there.
Checked with OpenTofu 1.13 on 1 Nov 2026
The problem
Aina built Kedai Kancil from her laptop. Today Ben runs tofu apply with the same blueprint, on his laptop. His folder has no state file. What does his plan want?
Pick one answer.
Try it
Where is the register now? Type ls. Then read it: cat terraform.tfstate.
Blueprint (your .tf files)init done
local_file.menurandom_pet.stall
Built (the state file)state #1
local_file.menurandom_pet.stall
- stall
- lucky-civet
Change a file, then run tofu plan to see what it means.
Hint
ls lists the files. cat prints one.Watch
Tap the two lines that say where the register goes.
0 of 2 found
A backend: Where the register (the state) lives. A shared one online lets a whole team read the same register. is where the register lives. A shared one sits online, so the whole team reads the same register.
Try it
Sort each fact: a file on one laptop, or a shared backend?
Drag a card into a box. Or tap the card, then tap the box.
Watch
Moving day. Add the backend block, then run tofu init. It asks before it copies the register. This real run moved it to a new folder.
Predict
Put the moving steps in order.
First step at the top. Put these in order. Use the arrows, or drag.
- Make the shared place first (a bucket)
- Run tofu init and answer yes
- Add the backend block to the blueprint
- Run tofu plan: "No changes" means it worked
- Commit the backend block, never the state file
Check
Could you share terraform.tfstate through Git instead?
Pick one answer.
You did it!
You can now explain where a team keeps its register, and how to move it.
Go deeper (optional)
Other backends: gcs, azurerm, pg, kubernetes, http and more. Terraform also offers HCP Terraform (the cloud block). OpenTofu can also encrypt the state itself. After a move, OpenTofu empties the old local file and keeps a .backup copy.
Real rep (optional): move a register on your own machine. No cloud, no cost.
Real mission
tofu init && tofu applytofu inittofu state list && ls register
0 of 5 steps done ยท Your ticks are saved.
Bahasa Melayu
Aina bina Kedai Kancil dari laptopnya. Hari ini Ben jalankan tofu apply dengan pelan yang sama, di laptopnya. Foldernya tiada fail state. Apa yang plan dia mahu buat?
Di mana daftar itu sekarang? Taip ls. Kemudian baca: cat terraform.tfstate.
ls senaraikan fail. cat paparkan satu fail.Backend (tempat simpan daftar) ialah rumah untuk daftar. Backend bersama ada dalam talian. Jadi seluruh pasukan baca daftar yang sama.
Susun setiap fakta: fail di satu laptop, atau backend bersama?
Hari pindah. Tambah blok backend, kemudian jalankan tofu init. Ia tanya dulu sebelum salin daftar. Larian sebenar ini pindahkannya ke folder baharu.
Susun langkah pindah mengikut urutan.
Bolehkah anda kongsi terraform.tfstate melalui Git sahaja?
Kini anda boleh terangkan di mana pasukan simpan daftarnya, dan cara pindahkannya.
You finished this before. Practice is always welcome!
Official docs: OpenTofu: state ยท OpenTofu: remote state ยท OpenTofu: backend configuration ยท OpenTofu: the s3 backend ยท Terraform: the s3 backend
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?