DEV Community

Latchu@DevOps
Latchu@DevOps

Posted on

πŸš€ From Manual Clicks to Code: My First Step into Terraform (And Why You Should Too)

Let me take you on a journey β€” the one where I stopped clicking around AWS Console and started automating my cloud like a boss. This is Day 1 of learning Terraform, but trust me, this day one will make you feel like a pro already.

🧱 What Is Infrastructure as Code (IaC)?

Imagine this:

You’re a DevOps engineer. A teammate asks, β€œHey, can you create an S3 bucket for me?”

Sure, you log in, click around, and in 2 minutes β€” done.

Now imagine 100 teams ask you that.

Do you still want to click around 100 times?

That's the problem IaC solves.

With Infrastructure as Code, you define your infrastructure in a file, like this:

resource "aws_s3_bucket" "my_bucket" {
  bucket = "my-awesome-bucket"
}
Enter fullscreen mode Exit fullscreen mode

Run it once with the help of for_each or count operation, and 100 buckets are created.
No clicking. Just code. Just magic.

🌍 Enter Terraform: The Universal Cloud Whisperer

  • AWS has CloudFormation.
  • Azure has ARM Templates.
  • GCP has Deployment Manager.

But Terraform? It speaks to all of them.

🧠 Learn Terraform once, and you can automate infra in any cloud provider.

It uses HCL (HashiCorp Configuration Language) β€” super simple and readable.
And it’s backed by a huge open-source community.

πŸ› οΈ Getting Started: Setup in 2 Ways

Local Setup (Windows, Mac, Linux):

  • Download Terraform from the official site.
  • Set up AWS credentials using aws configure.

Don’t Have a Laptop?

  • Use GitHub Codespaces (60 free hours/month!)
  • Preinstalled Terraform + AWS CLI β€” all in your browser!

πŸ§‘β€πŸ’» Your First Terraform Script

Let’s launch an EC2 instance β€” the Hello World of cloud infra.

main.tf

provider "aws" {
  region = "us-east-1"
}

resource "aws_instance" "demo" {
  ami           = "ami-xxxxxx"       # Replace with your AMI ID
  instance_type = "t2.micro"
  subnet_id     = "subnet-xxxxxx"
  key_name      = "your-keypair"
}
Enter fullscreen mode Exit fullscreen mode

πŸ” The 4 Magic Terraform Commands

Command What It Does
terraform init Initializes the working directory
terraform plan Shows what will be created/changed
terraform apply Applies the infrastructure
terraform destroy Tears it all down

πŸ’‘ Pro Tip: Always run plan before apply. It’s like a dry run β€” no surprises.

πŸ“˜ Terraform State β€” The Hidden Brain

Terraform keeps track of what it created in a file called terraform.tfstate.
That’s how it knows what exists when you run future changes.

We’ll go deeper into this in later days β€” for now, just know it’s your infra’s memory.

🎯 Final Thoughts: Why You’ll Never Forget This

  • You stopped thinking of infra as β€œthings you click on” and started seeing it as β€œcode you can manage.”
  • You learned to use one tool (Terraform) to rule all clouds.
  • You wrote your first script, deployed infra, and destroyed it β€” like a pro.

🧱 This is just Day 1. But it lays the foundation for scalable, automated, version-controlled infrastructure that works every time.

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.