BM: Baca dalam Bahasa Melayu
World T1: Blueprints
Providers and init
You will learn: what providers are, what tofu init does, and how to build your first stall.
Checked with OpenTofu 1.13 on 1 Nov 2026
The problem
A new folder, straight from Git. Type tofu plan. What does OpenTofu say?
Blueprint (your .tf files)needs tofu init
local_file.signnot built yetrandom_pet.stallnot built yet
Built (the state file)
Nothing built yet.
Change a file, then run tofu plan to see what it means.
Error: Inconsistent dependency lock file. Plain words: the tools are not here yet.
Watch
OpenTofu canβt make files or names by itself. provider: A plugin that knows how to build one family of things, like a supplier. random makes names; local makes files. do the work, like suppliers. Who supplies what?
Drag a card into a box. Or tap the card, then tap the box.
Check
providers.tf lists the suppliers. ~> 3.7 means β3.7 or newer, but not 4β. Which version may init pick?
random = {
source = "hashicorp/random"
version = "~> 3.7"
}Pick one answer.
Try it
Now get the suppliers. Type tofu init.
Blueprint (your .tf files)needs tofu init
local_file.signnot built yetrandom_pet.stallnot built yet
Built (the state file)
Nothing built yet.
Change a file, then run tofu plan to see what it means.
Hint
Typetofu init.Check
This is what init printed. Tap the two lines where a download starts.
Tap the lines that match.
0 of 2 found
.terraform.lock.hcl is the lock file: .terraform.lock.hcl: the receipt tofu init writes. It records which provider versions it picked. Commit it to Git.: a receipt of the versions. Commit it to Git.
Try it
Your first real build. Type tofu plan and read it. Then tofu apply, and yes.
Blueprint (your .tf files)init done
local_file.signnot built yetrandom_pet.stallnot built yet
Built (the state file)
Nothing built yet.
Change a file, then run tofu plan to see what it means.
Hint
tofu plan, then tofu apply, then yes.Predict
You run tofu init again in the same folder. What happens?
Pick one answer.
You did it!
You can now explain providers and run your first init, plan and apply.
Go deeper (optional)
init also makes a hidden .terraform/ folder with the provider programs. Keep it out of Git; commit .terraform.lock.hcl. OpenTofu downloads providers from its own registry, registry.opentofu.org. terraform init does the same job in Terraform, from HashiCorpβs registry.
Bahasa Melayu
Folder baru, terus dari Git. Taip tofu plan. Apa OpenTofu kata?
Error: Inconsistent dependency lock file. Maksudnya: alatan belum ada di sini.
OpenTofu tak boleh buat fail atau nama sendiri. Provider (pembekal) buat kerja itu. Siapa bekal apa?
providers.tf senaraikan pembekal. ~> 3.7 bermaksud β3.7 atau lebih baru, tapi bukan 4β. Versi mana init boleh pilih?
random = {
source = "hashicorp/random"
version = "~> 3.7"
}
Sekarang dapatkan pembekal. Taip tofu init.
tofu init.Ini yang init paparkan. Tekan dua baris di mana muat turun bermula.
.terraform.lock.hcl ialah lock file (fail kunci): resit versi. Commit fail ini ke Git.
Binaan sebenar pertama anda. Taip tofu plan dan baca. Kemudian tofu apply, dan yes.
tofu plan, kemudian tofu apply, kemudian yes.Anda jalankan tofu init sekali lagi dalam folder yang sama. Apa jadi?
Kini anda boleh terangkan provider dan jalankan init, plan dan apply pertama anda.
You finished this before. Practice is always welcome!
Official docs: tofu init Β· OpenTofu: providers Β· OpenTofu: provider requirements Β· OpenTofu: dependency lock file
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?