Skip to main content

Command Palette

Search for a command to run...

Day 1: Introduction to Terraform

Published
2 min read
Day 1: Introduction to Terraform
S

DevOps Enginner

What is Terraform?

Terraform is an open-source Infrastructure as Code (IaC) tool created by HashiCorp.
It allows you to define, provision, and manage infrastructure using simple configuration files instead of manual clicks.

With Terraform, infrastructure becomes:

  • Version-controlled

  • Repeatable

  • Predictable

  • Automated

Why Terraform is Used in Modern Tech Industry

Modern systems are:

  • Cloud-native

  • Multi-region

  • Microservice-based

  • Fast-scaling

Terraform helps teams:

  • Provision infra in minutes instead of hours

  • Avoid manual configuration mistakes

  • Maintain consistency across environments (dev, staging, prod)

  • Collaborate using Git-based workflows

  • Scale infrastructure safely

ToolScope
TerraformMulti-cloud (AWS, Azure, GCP, more)
PulumiIaC using programming languages
AWS CloudFormationAWS only
AWS CDKAWS only (code-based IaC)
AWS SAMAWS serverless deployments
Azure ARM / BicepAzure only
GCP Config ControllerGCP only

Why Do We Need Terraform?

Without Terraform:

  • Infrastructure is created manually

  • No clear documentation of infra

  • Hard to reproduce environments

  • Changes are risky and error-prone

With Terraform:

  • Infra lives as code

  • Easy rollback and audit

  • Same config works across environments

  • Infrastructure becomes part of CI/CD

Challenges Without IaC

  • “It works on my machine” issues

  • Environment drift

  • Manual misconfigurations

  • Slow deployments

  • No single source of truth

Terraform eliminates these problems.

Where Terraform is Mostly Used

  • Cloud infrastructure provisioning

  • Kubernetes clusters

  • Networking (VPCs, subnets, gateways)

  • Databases and storage

  • CI/CD pipeline infra

  • Multi-region deployments

Terraform Installation Guide

Linux

sudo apt update
sudo apt install -y wget unzip

wget https://releases.hashicorp.com/terraform/1.9.0/terraform_1.9.0_linux_amd64.zip
unzip terraform_1.9.0_linux_amd64.zip
sudo mv terraform /usr/local/bin/

terraform version

windows

  • Download Terraform from official site

  • Extract terraform.exe

  • Add it to System PATH

  • verify in cmd:- terraform version

Other methods

# For macOS
brew install hashicorp/tap/terraform

# For Ubuntu/Debian
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /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

Setup Commands

terraform -install-autocomplete
alias tf=terraform
terraform -version

Common Installation Error (macOS)

If you encounter: Error: No developer tools installed.

Install Command Line Tools:

xcode-select --install

For more details visit my github repo:- https://github.com/sidharthhhh/terraform

https://github.com/piyushsachdeva/Terraform-Full-Course-Aws/tree/main/lessons/day01

For more detail explaination watch:- https://youtu.be/s5fwSG_00P8?si=bj9kYlOZH3Q6Eawy

More from this blog

Sidharth

40 posts