πŸš€ Day 11 of My DevOps Journey: Terraform β€” Infrastructure as Code (IaC) ☁️

Hello dev.to community! πŸ‘‹

Yesterday, I explored Docker Compose β€” a tool that simplifies managing multi-container apps. Today, I’m stepping into the world of Infrastructure as Code (IaC) with Terraform.

πŸ”Ή Why IaC Matters
Traditionally, provisioning in…


This content originally appeared on DEV Community and was authored by Bhaskar Sharma

Hello dev.to community! πŸ‘‹

Yesterday, I explored Docker Compose β€” a tool that simplifies managing multi-container apps. Today, I’m stepping into the world of Infrastructure as Code (IaC) with Terraform.

πŸ”Ή Why IaC Matters
Traditionally, provisioning infrastructure meant manual clicks on cloud dashboards β€” slow, error-prone, and hard to reproduce.
With IaC tools like Terraform, infrastructure is:

Automated β†’ Write once, provision anywhere.

Version-controlled β†’ Store infra code in Git, track changes like software.

Consistent & Repeatable β†’ No more β€œit works on my cloud” issues.

🧠 Core Terraform Concepts I’m Learning

Providers β†’ Plugins to interact with cloud (AWS, Azure, GCP).

Resources β†’ Define infrastructure (VMs, networks, S3 buckets, etc.).

State File β†’ Tracks the current infrastructure state.

Plan & Apply β†’ Preview changes before applying them.

πŸ”§ Example: Create an AWS EC2 Instance

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

resource "aws_instance" "my_ec2" {
ami = "ami-08e5424edfe926b43"
instance_type = "t2.micro"
tags = {
Name = "DevOps-Instance"
}
}

πŸ‘‰ Run:

terraform init # Initialize provider plugins

terraform plan # Preview execution plan

terraform apply # Create infrastructure πŸš€

πŸ› οΈ Mini Use Cases in DevOps

Spin up test environments on-demand.

Automate cloud infrastructure for CI/CD pipelines.

Version-control infra changes (review infra via pull requests).

Reduce cloud cost by managing lifecycle (create/destroy easily).

⚑ Pro Tips

Always use terraform.tfvars for secrets/variables.

Store state file remotely (S3 + DynamoDB for AWS).

Use modules to reuse infrastructure code.

Combine with Ansible later for config management.

πŸ§ͺ Hands-on Mini-Lab (Try this!)
1️⃣ Install Terraform.
2️⃣ Write a Terraform config to provision an EC2 instance.
3️⃣ Run terraform init, plan, apply.
4️⃣ Destroy resources with terraform destroy (save money πŸ’Έ).

🎯 Key Takeaway
Terraform brings the power of code to infrastructure β€” making it automated, versioned, and consistent. A must-have skill in every DevOps toolkit.

πŸ”œ Tomorrow (Day 12)
I’ll explore Ansible β€” automating configuration management and deployments. πŸ”§

πŸ”– #Terraform #DevOps #IaC #Cloud #Automation #SRE #InfrastructureAsCode #AWS #CloudNative


This content originally appeared on DEV Community and was authored by Bhaskar Sharma


Print Share Comment Cite Upload Translate Updates
APA

Bhaskar Sharma | Sciencx (2025-09-11T04:14:52+00:00) πŸš€ Day 11 of My DevOps Journey: Terraform β€” Infrastructure as Code (IaC) ☁️. Retrieved from https://www.scien.cx/2025/09/11/%f0%9f%9a%80-day-11-of-my-devops-journey-terraform-infrastructure-as-code-iac-%e2%98%81%ef%b8%8f/

MLA
" » πŸš€ Day 11 of My DevOps Journey: Terraform β€” Infrastructure as Code (IaC) ☁️." Bhaskar Sharma | Sciencx - Thursday September 11, 2025, https://www.scien.cx/2025/09/11/%f0%9f%9a%80-day-11-of-my-devops-journey-terraform-infrastructure-as-code-iac-%e2%98%81%ef%b8%8f/
HARVARD
Bhaskar Sharma | Sciencx Thursday September 11, 2025 » πŸš€ Day 11 of My DevOps Journey: Terraform β€” Infrastructure as Code (IaC) ☁️., viewed ,<https://www.scien.cx/2025/09/11/%f0%9f%9a%80-day-11-of-my-devops-journey-terraform-infrastructure-as-code-iac-%e2%98%81%ef%b8%8f/>
VANCOUVER
Bhaskar Sharma | Sciencx - » πŸš€ Day 11 of My DevOps Journey: Terraform β€” Infrastructure as Code (IaC) ☁️. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/09/11/%f0%9f%9a%80-day-11-of-my-devops-journey-terraform-infrastructure-as-code-iac-%e2%98%81%ef%b8%8f/
CHICAGO
" » πŸš€ Day 11 of My DevOps Journey: Terraform β€” Infrastructure as Code (IaC) ☁️." Bhaskar Sharma | Sciencx - Accessed . https://www.scien.cx/2025/09/11/%f0%9f%9a%80-day-11-of-my-devops-journey-terraform-infrastructure-as-code-iac-%e2%98%81%ef%b8%8f/
IEEE
" » πŸš€ Day 11 of My DevOps Journey: Terraform β€” Infrastructure as Code (IaC) ☁️." Bhaskar Sharma | Sciencx [Online]. Available: https://www.scien.cx/2025/09/11/%f0%9f%9a%80-day-11-of-my-devops-journey-terraform-infrastructure-as-code-iac-%e2%98%81%ef%b8%8f/. [Accessed: ]
rf:citation
» πŸš€ Day 11 of My DevOps Journey: Terraform β€” Infrastructure as Code (IaC) ☁️ | Bhaskar Sharma | Sciencx | https://www.scien.cx/2025/09/11/%f0%9f%9a%80-day-11-of-my-devops-journey-terraform-infrastructure-as-code-iac-%e2%98%81%ef%b8%8f/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.