ခဏလေး ဒီလိုပဲ စဉ်းစားကြည့်
ဒီ round က learn ခဲ့ပြီးသား Basic/Intermediate concept တွေကို လက်တွေ့ ပြန်စမ်းကြည့်ဖို့ round ပါ — Resource vs Variable vs Output ကို ခွဲသိခြင်း, HCL config ထဲက error ကို ရှာဖွေခြင်း, `terraform` command ကို မှန်ကန်စွာ ရေးတတ်ခြင်းကိုပဲ ကိုယ်တိုင် လက်တွေ့ လုပ်ကြည့်ရမှာပါ။ Task တစ်ခုချင်းစီက ၅ မိနစ်ထက် မကြာသင့်ပါဘူး။
လက်တွေ့ scenario နဲ့ ချိတ်ကြည့်မယ်
Task 1: 'Resource', 'Variable', 'Output' သုံးလုံးရဲ့ တာဝန် ကွာခြားချက်ကို ဝါကျတစ်ကြောင်းစီနဲ့ ရှင်းပြပါ။ Task 2: `resource "aws_instance" "web" { instance_type = var.instance_type }` လို့ ရေးထားပေမယ့် `variable "instance_type"` block ကို config file ထဲမှာ လုံးဝ define မလုပ်ထားရင် ဘာ error ဖြစ်မလဲ ခန့်မှန်းပြီး ရေးပါ။ Task 3: State file ဆိုတာ ဘာလို့ အရေးကြီးလဲ, local state ရဲ့ risk ဘာတွေလဲ ဥပမာနဲ့တကွ ရေးပါ။ Task 4: `terraform plan` run လိုက်ရင် unexpected change (drift) တွေ့ရတယ်ဆိုရင် ဘယ် command ၂ ခုနဲ့ investigate စမလဲ ရေးပါ။
အတူတူ ကြည့်မယ်
# Task 2 - undefined variable
resource "aws_instance" "web" {
instance_type = var.instance_type # ERROR!
}
# No `variable "instance_type" { ... }` block exists anywhere.
Result: Terraform will error at `terraform plan` time with
something like: "Reference to undeclared input variable"
# Task 4 - investigating drift
terraform plan # shows what changed vs config
terraform state show <resource> # inspect the current tracked stateResource/Variable/Output ကွာခြားချက်၊ undefined variable error ရှာဖွေခြင်း၊ drift investigate command များ ရရှိလာမည်။၅ မိနစ် စမ်းကြည့်
ကိုယ်ပိုင် config တစ်ခု ရေးပြီး တမင် undefined variable reference bug ထည့်ကြည့်ပါ — `terraform plan` ပြီးရင် ဘာဖြစ်လဲ ကိုယ်တိုင် သက်သေပြကြည့်ပါ။
သတိလေးတစ်ချက်
ဒီ round မှာ cloud account setup လုပ်ဖို့ မလိုပါဘူး — concept/debugging logic ကိုပဲ အဓိကထား practice လုပ်ခြင်းပါ။