BM: Baca dalam Bahasa Melayu
World T1: Blueprints
HCL blocks
You will learn: how to read a block, and how one block uses another.
Checked with OpenTofu 1.13 on 1 Nov 2026
The problem
Here is a tiny blueprint. What does it ask OpenTofu to make?
resource "random_pet" "stall" {
length = 2
}Pick one answer.
Watch
Tap the two lines where a new block starts.
Tap the lines that match.
0 of 2 found
A blueprint is made of block: One part of a blueprint. It starts with a type and labels, like resource "local_file" "sign", then its settings in { }.. This language is called HCL.
Try it
Build the first line of a block. It makes a file, and you call it menu.
Tap the pieces in the right order.
Predict
The sign uses ${random_pet.stall.id}. That is a reference: Using a value from another block by its address: type, name, then the value, like random_pet.stall.id.: type, name, then the value. What is stall here?
Pick one answer.
Try it
Open main.tf. Change Welcome to into Selamat datang ke. Then type 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
Edit only the words inside the quotes, before${.Check
Sort the parts of a block.
Drag a card into a box. Or tap the card, then tap the box.
You did it!
You can now read a block and follow a reference.
Go deeper (optional)
Lines starting with # are comments. OpenTofu reads every .tf file in the folder as one blueprint. File names are only for people. In strings, \n is a new line and ${ } puts a value inside the text.
The settings inside a block are called argument: One setting inside a block: a name, an equals sign and a value, like length = 2.. Each provider’s docs list the arguments its resources take.
Bahasa Melayu
Ini pelan yang kecil. Apa yang ia minta OpenTofu buat?
resource "random_pet" "stall" {
length = 2
}
Tekan dua baris di mana blok baru bermula.
Pelan dibina daripada block (blok). Bahasa ini dipanggil HCL.
Bina baris pertama sebuah blok. Ia buat fail, dan anda namakannya menu.
Papan tanda guna ${random_pet.stall.id}. Itu reference (rujukan): jenis, nama, kemudian nilai. Apa itu stall di sini?
Buka main.tf. Tukar Welcome to jadi Selamat datang ke. Kemudian taip tofu apply dan yes.
${.Asingkan bahagian sebuah blok.
Kini anda boleh baca blok dan ikut reference.
You finished this before. Practice is always welcome!
Official docs: OpenTofu: configuration syntax · OpenTofu: resources · OpenTofu: references to named values
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?