🎯 Objective
Learn Terraform workflow by creating and managing a Resource Group in Microsoft Azure
📁 Step 1: Create Project Folder
mkdir tf-azure-rg
cd tf-azure-rg
🧾 Step 2: provider.tf
provider "azurerm" {
features {}
}
🧾 Step 3: variables.tf
variable "rg_name" {
default = "demo-rg-tf"
}
variable "location" {
default = "eastus"
}
🧾 Step 4: main.tf (Resource Group Only)
resource "azurerm_resource_group" "rg" {
name = var.rg_name
location = var.location
tags = {
environment = "Dev"
project = "Terraform-Lab"
}
}
🧪 Step 5: Terraform Workflow Execution
🔹 1. Terraform Init
terraform init
✔ Downloads Azure provider
✔ Initializes working directory
🔹 2. Terraform Validate
terraform validate
✔ Checks syntax
✔ Ensures config is correct
🔹 3. Terraform Plan
terraform plan
✔ Shows what Terraform will create
👉 Example Output:
+ azurerm_resource_group.rg will be created
🔹 4. Terraform Apply
terraform apply -auto-approve
✔ Creates Resource Group in Azure
🔹 5. Verify in Azure
Go to Azure Portal → Check Resource Group
🔹 6. Terraform Destroy
terraform destroy -auto-approve
✔ Deletes Resource Group
✔ Cleans all resources
🧠 What You Learned
✔ Write Terraform code
✔ Initialize provider
✔ Validate configuration
✔ Plan infrastructure
✔ Apply changes
✔ Destroy resources
🎯 Interview Answer (Short)
👉 Terraform workflow:
Write → Init → Validate → Plan → Apply → Destroy
💡 Bonus: Output Example
Add this in output.tf:
output "rg_name" {
value = azurerm_resource_group.rg.name
}
🚀 Next Step Suggestions
After this, try:
- Multiple resource groups (count / for_each)
- Modules
- Remote backend
🎓 Learn with Eduarn
At Eduarn.com, you get:
✔ Hands-on Terraform labs
✔ Azure + DevOps real-time projects
✔ Corporate & retail training
Struggling to learn Terraform with real-time scenarios?
ReplyDelete👉 At Eduarn.com, we provide hands-on Azure + DevOps labs that make concepts practical 🚀
Most learners understand theory but fail in real projects…
ReplyDelete💡 That’s why Eduarn.com focuses on project-based learning with real cloud environments
Looking for Terraform training, Azure DevOps training, or cloud upskilling?
ReplyDelete👉 Eduarn.com offers both online retail & corporate training programs
Want to become job-ready in DevOps & Cloud?
ReplyDelete📩 Comment “TERRAFORM” and we’ll guide you with the right learning path
Join 1000+ learners upgrading their careers with Eduarn LMS platform
ReplyDelete✔ Hands-on labs
✔ Real-time projects
✔ Expert trainers
Are you using Terraform in your current role or learning it?
ReplyDelete👇 Comment below — we’ll suggest the best roadmap for you