BM: Baca dalam Bahasa Melayu
World T3: State & Teams
Workspaces or folders per environment?
You will learn: when a second register (a workspace) is enough, and when each environment needs its own folder.
Checked with OpenTofu 1.13 on 1 Nov 2026
The problem
Kedai Kancil wants a test copy of the shop, next to the real one. Same blueprint. How many registers do you need?
Pick one answer.
Watch
A workspace: A second register for the same blueprint and backend. Good for short test copies. is a second register for the same blueprint, in the same backend. The star shows the one you are in.
Try it
This blueprint puts terraform.workspace in the file name. Run tofu apply. Which sign appears?
Blueprint (your .tf files)init done
local_file.signnot built yet
Built (the state file)
Nothing built yet.
Change a file, then run tofu plan to see what it means.
Hint
Everyone starts in the workspace calleddefault.Predict
Now someone switches to the workspace test and applies. What is the new file called?
Pick one answer.
Check
Workspace or separate folder? Sort each need.
Drag a card into a box. Or tap the card, then tap the box.
Watch
Tap the folder that both environments share.
0 of 1 found
Folders per environment: each one has its own backend, keys and reviewers. A module keeps them alike. That is World T4.
Try it
Build the command that switches to test, and makes it if it is missing.
Tap the pieces in the right order.
You did it!
You can now choose between a workspace and a folder per environment.
Go deeper (optional)
With the local backend, workspace registers live in terraform.tfstate.d/<name>/. The practice terminal has one workspace only, so try the rest at home. Where the story breaks: a real building canβt be copied in a second. A register can, so guard it.
Real mission
tofu init && tofu workspace new testtofu applytofu workspace select default && tofu state listtofu workspace select test && tofu destroy && tofu workspace select default && tofu workspace delete test
0 of 4 steps done Β· Your ticks are saved.
Bahasa Melayu
Kedai Kancil mahu salinan ujian kedai, di sebelah kedai sebenar. Pelan sama. Berapa daftar yang anda perlukan?
Workspace (ruang kerja) ialah daftar kedua untuk pelan yang sama, dalam backend yang sama. Bintang tunjuk yang anda sedang guna.
Pelan ini letak terraform.workspace dalam nama fail. Jalankan tofu apply. Papan tanda mana yang muncul?
default.Sekarang seseorang tukar ke workspace test dan jalankan apply. Apa nama fail baharu?
Workspace atau folder berasingan? Susun setiap keperluan.
Folder setiap persekitaran: setiap satu ada backend, kunci dan penyemak sendiri. Modul pastikan semuanya serupa. Itu Dunia T4.
Bina arahan yang tukar ke test, dan ciptanya jika belum ada.
Kini anda boleh pilih antara workspace dan folder untuk setiap persekitaran.
You finished this before. Practice is always welcome!
Official docs: OpenTofu: workspaces (language) Β· OpenTofu: workspaces (CLI) Β· Terraform: workspaces
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?