Day 11 - Infrastructure as Code | Terraform
Hi there! I'm Dinesh, a passionate Cloud and DevOps enthusiast. I love to dive into the latest new technologies and sharing my journey through blog.
Search for a command to run...
Hi there! I'm Dinesh, a passionate Cloud and DevOps enthusiast. I love to dive into the latest new technologies and sharing my journey through blog.
No comments yet. Be the first to comment.
1. Difference between Docker and Kubernetes Docker → Builds and runs containers.Kubernetes → Orchestrates containers across multiple nodes. Key points: Docker = container runtime. Kubernetes = container orchestration tool. Kubernetes provides auto...
In this session, we learn how to monitor a Kubernetes cluster using Prometheus and Grafana.This is not just theory — there is a GitHub repository containing all installation commands and demo steps.The repo will also be enhanced later with advanced K...
1. What is a ConfigMap in Kubernetes? A ConfigMap is used to store non-sensitive configuration data that your application needs — such as: Database port Connection type Any general configuration values In normal applications (non-Kubernetes), de...
Kubernetes normally supports built-in resources like: Deployment Service Pod ConfigMap Secret Ingress These are called native resources. Sometimes companies (Istio, ArgoCD, Prometheus Operator, Kyverno, etc.) want to add new features that Kub...
1. Why Kubernetes Services Are Needed When a Pod is created in Kubernetes, it receives a dynamic IP address.If the Pod dies and restarts, its IP changes.So other Pods (like checkout → payments) cannot rely on Pod IP because it changes, creating issue...
Flipkart has many applications (example: 300 apps).
To run these applications, servers are required.
These servers (compute resources like CPU, RAM, storage) can be created:
On cloud platforms (AWS, Azure, GCP, etc.)
On physical machines (on-premises)
On other cloud providers like DigitalOcean, Oracle Cloud, etc.
You decide to host everything on AWS.
So you automate the creation of resources like EC2, S3, RDS using:
AWS CLI
CloudFormation Templates (CFT)
AWS CDK
Other AWS automation tools
You create hundreds of scripts using CloudFormation (CFT) to automate AWS resources.
Everything works smoothly.
Later, management decides to move from AWS to Azure.
Your existing CFT scripts become useless because:
On Azure, you now have to rewrite everything using:
So you again convert all scripts manually.
After some time, the company is unhappy with Azure too and decides to move to on-premises using:
OpenStack uses Heat Templates, so again you must rewrite all automation scripts.
This is a repeating problem:
✔ Every cloud provider has its own IaC syntax
✔ You keep rewriting scripts again and again
✔ It wastes time, effort, and learning resources
Nowadays, many companies use Hybrid Cloud, meaning:
Some infrastructure in AWS
Some in Azure
Some on-prem with OpenStack
Sometimes even GCP or others
Example:
AWS is good for storage
Azure is good for DevOps services
So Flipkart uses both.
This forces a DevOps engineer to learn:
AWS CFT
Azure ARM
OpenStack Heat Templates
Many other provider-specific tools
This becomes too complicated.
To solve this multi-tool problem, HashiCorp created Terraform.
Terraform says:
“Instead of learning dozens of tools, learn just one — Terraform.”
Works with all cloud providers (AWS, Azure, GCP, OpenStack…)
You write one type of script (HCL) for all providers
Terraform internally communicates with the provider’s API
Migration from one cloud to another becomes much easier
(only small changes like provider block / module updates)
Terraform uses the concept:
Earlier tools were:
CFT → AWS-specific
ARM → Azure-specific
Heat → OpenStack-specific
But Terraform works across all providers because:
Each cloud has APIs:
AWS APIs
Azure APIs
GCP APIs
OpenStack APIs
Terraform reads your .tf scripts and:
Converts them into correct API calls
Sends those calls to providers
Creates or updates the infrastructure
Shows results back to you
So you don’t need to write API requests yourself.
API = Application Programming Interface
It allows one application to talk to another programmatically.
Example:
Normally, you open Google in a browser and search manually (UI).
But if you want to talk to Google using a script, you use an API.
Similarly:
Terraform talking directly to cloud APIs
One language, multiple cloud providers
Terraform solves the problem of learning many IaC tools.