🛠️ Terraform Series Part 2: Setup Guide (Install & Prepare Environment)

Terraform Setup Guide

📘 Terraform Series — Part 2

Post 1 မှာတော့ Terraform ဆိုတာဘာလဲ၊ ဘာကြောင့် အသုံးပြုသင့်လဲ ဆိုတာတွေကို လေ့လာခဲ့ပါတယ်။

ဒီ post မှာတော့ လက်တွေ့ စတင်အသုံးပြုဖို့အတွက် Environment Setup လုပ်သွားပါမယ်။


🎯 ဒီ post မှာ လုပ်မည့်အရာများ

ဒီ guide အဆုံးမှာ သင်ဟာ —

  • Terraform ကို install လုပ်နိုင်မယ်
  • AWS CLI ကို configure လုပ်နိုင်မယ်
  • Environment ကို verify လုပ်နိုင်မယ်
  • Terraform ကို စတင်အသုံးပြုနိုင်မယ်

👉 In short: You will prepare your system to run Terraform.


🧰 အသုံးပြုမည့် Environment

ဒီ tutorial ကို —

WSL Ubuntu / Linux

ပေါ်မှာ အခြေခံထားပါတယ်။

(macOS / Windows မှာလည်း သဘောတရားတူပါတယ်)


🔹 Step 1 — Terraform Install ပြုလုပ်ခြင်း

Tarraform ကို Install လုပ်ဖို့ အောက်ပါ command တွေကို run ပါ —

sudo apt update
sudo apt install -y gnupg software-properties-common

wget -O- https://apt.releases.hashicorp.com/gpg | \
gpg --dearmor | \
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg

echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \
https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \
sudo tee /etc/apt/sources.list.d/hashicorp.list

sudo apt update
sudo apt install terraform

✅ Verify Installation

terraform version

Expected output —

Terraform v1.x.x

👉 In short: Terraform is installed successfully.


🔹 Step 2 — AWS CLI Install လုပ်ခြင်း

sudo apt install awscli -y

Verify —

aws --version

🔹 Step 3 — AWS Credentials Configure

Terraform က AWS နဲ့ connect လုပ်နိုင်ဖို့ AWS CLI ကို configure လုပ်ရပါမယ်။

aws configure

ထည့်ရမယ့်အချက်တွေ —

AWS Access Key ID
AWS Secret Access Key
Region (e.g. ap-southeast-1)
Output format (json)

🔍 Connection Test

aws sts get-caller-identity

👉 Successful ဖြစ်ရင် AWS account info ပြပါလိမ့်မယ်။

👉 In short: Your AWS connection is working.


🔹 Step 4 — First Terraform Project Create

Folder အသစ်တစ်ခုဖန်တီးပါ —

mkdir terraform-test
cd terraform-test

File တစ်ခုဖန်တီးပါ —

touch main.tf

အောက်ပါ code ထည့်ပါ —

provider "aws" {
  region = "ap-southeast-1"
}

🔹 Step 5 — Terraform Initialize

terraform init

Expected output —

Terraform has been successfully initialized!

👉 Terraform က AWS provider ကို download လုပ်ပြီး project ကို prepare လုပ်ပေးတာပါ။

👉 In short: Terraform is ready to use.


⚠️ Common Errors (လက်တွေ့ ကြုံရနိုင်သော ပြဿနာများ)

❌ AWS credentials error

👉 Fix:

aws configure

❌ Network / STS error

aws sts get-caller-identity

❌ Terraform not found

terraform version

🎯 ဒီနေ့ သင် လုပ်ပြီးသွားတာ

  • Terraform install လုပ်ပြီးပြီ
  • AWS CLI configure လုပ်ပြီးပြီ
  • Environment verify လုပ်ပြီးပြီ

👉 သင် Terraform ကို အသုံးပြုဖို့ Ready ဖြစ်နေပါပြီ။


💡 DevOps Insight

Setup မှန်ကန်မှုက အရေးကြီးပါတယ်။

Terraform ကို အသုံးပြုမယ့်အခါတိုင်း အောက်ပါ command တွေကို verify လုပ်ထားသင့်ပါတယ် —

terraform version
aws sts get-caller-identity

👉 In short: Always verify before building infrastructure.


🚀 နောက်ထပ် ဘာလာမလဲ?

နောက် post မှာတော့ —

  • Terraform နဲ့ EC2 instance တစ်ခု တည်ဆောက်မယ်
  • plan နဲ့ apply ကို လက်တွေ့ အသုံးပြုမယ်
  • Infrastructure ကို code နဲ့ တည်ဆောက်မယ်

👉 Let’s move from setup → real infrastructure 🔥


📚 Terraform Learning Series

  • Part 1: Why Terraform
  • Part 2: Setup Guide (ယခု post)
  • Part 3: First EC2 Deployment (နောက်လာမယ့် post)

👉 Let’s continue this journey together 🚀

👨‍💻 English Version “Read full English version on Dev.to → Visit Here

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Scroll to Top
0
Would love your thoughts, please comment.x
()
x
Share via
Copy link