Day 72 of 100 Days : Getting into Terraform: Concepts, and Scaling with Modules

Welcome back to Day 72 of my 100 Days of DevOps journey! 🎉 Today, I’m diving into Terraform with stories and practical examples to make it easier to get started. Terraform is like the architect of your infrastructure — defining what gets built, where, and how. Let’s explore how you can master Terraform through relatable stories, key concepts, and hands-on learning.
Why Terraform? A Real-World Analogy
Imagine building a house. You don’t start by randomly stacking bricks and hoping it turns out okay. Instead, you:
Blueprint: Decide the layout and design (like Terraform’s configuration files).
Plan: Order the materials and check costs (like running
terraform plan
).Build: Construct the house (like applying
terraform apply
).Maintain: Fix issues or expand later (like managing state files).
Terraform is your blueprint and builder for cloud infrastructure. Instead of manually clicking buttons in AWS, Azure, or GCP, you define everything in code — and let Terraform handle the rest.
Story 1: Scaling Infrastructure with a Click
Picture this: A startup launches its e-commerce website. Everything is fine with one server until traffic spikes during a sale. The site crashes. Manually adding more servers takes hours, costing revenue.
Enter Terraform:
The startup uses Terraform to define a scalable infrastructure with auto-scaling groups, load balancers, and distributed databases.
With just one
terraform apply
command, Terraform provisions everything, ensuring the website can handle thousands of users seamlessly.
Lesson: Terraform isn’t just for provisioning servers; it’s for building resilient, scalable systems.
Story 2: The Disaster Recovery Hero
A financial services company faced an issue: What if their primary data center goes offline? A disaster recovery (DR) plan was needed.
Using Terraform, they:
Defined their primary infrastructure in code.
Created a DR environment in a different region.
Used the same Terraform configuration, tweaking a few variables, to mirror the setup.
When disaster struck, they restored services in minutes by running Terraform in the DR environment.
Lesson: Terraform’s modularity and reusability make it a lifesaver in disaster recovery scenarios.
Key Concepts to Master Terraform
Here’s what you should focus on as a beginner:
1. Terraform’s Workflow
The Terraform lifecycle involves three main steps:
Write: Create configuration files using HCL (HashiCorp Configuration Language).
Plan: Preview changes to ensure they’re as expected.
Apply: Execute the changes to build your infrastructure.
2. Providers
Terraform uses providers to interact with different cloud services (AWS, Azure, GCP). For example:
provider "aws" {
region = "us-east-1"
}
3. State Files
Terraform keeps a state file to track the resources it manages. This helps ensure changes are applied incrementally.
Story 3: Replacing ClickOps with DevOps
A DevOps engineer joined a company where teams managed infrastructure manually using AWS’s web console. Every deployment was inconsistent, and outages were common.
With Terraform, they:
Converted all manual setups into reusable Terraform configurations.
Standardized environments across staging, production, and testing.
Reduced errors by integrating Terraform into CI/CD pipelines.
Now, new infrastructure can be provisioned in minutes, and deployments are predictable.
Lesson: Terraform eliminates “ClickOps” (manual console work) and empowers DevOps teams with automation.
Practical Exercise: Your First Steps into Terraform
1. Install Terraform
Visit the Terraform Download Page and follow the installation instructions for your OS.
2. Create a Simple EC2 Instance
Write a configuration file:
provider "aws" { region = "us-east-1" } resource "aws_instance" "example" { ami = "ami-0abcd1234efgh5678" instance_type = "t2.micro" tags = { Name = "MyFirstInstance" } }
Initialize Terraform:
terraform init
Plan and Apply:
terraform plan terraform apply
3. Experiment with Variables
Refactor the above code to use variables:
variable "region" {
default = "us-east-1"
}
variable "instance_type" {
default = "t2.micro"
}
provider "aws" {
region = var.region
}
resource "aws_instance" "example" {
ami = "ami-0abcd1234efgh5678"
instance_type = var.instance_type
tags = {
Name = "MyFirstInstance"
}
}
What’s Next? Master Modules
Modules are Terraform’s superpower for scaling your projects. As described earlier, they let you package and reuse infrastructure components.
Final Thoughts
Terraform is not just a tool; it’s a mindset shift for managing infrastructure. It teaches you to think systematically and embrace automation, helping you focus on solving real problems instead of wrestling with manual tasks.
What’s your experience with Terraform so far? Share your thoughts, and let’s keep building! 🚀
Subscribe to my newsletter
Read articles from Munilakshmi G J directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Munilakshmi G J
Munilakshmi G J
"Aspiring DevOps Engineer on a 100-day journey to master the principles, tools, and practices of DevOps. Sharing daily insights, practical lessons, and hands-on projects to document my path from beginner to proficient. Passionate about continuous learning, automation, and bridging the gap between development and operations. Join me as I explore the world of DevOps, one day at a time!"