Infrastructure as Code (IaC) is the practice of managing servers, databases, networks, and cloud resources through code rather than manual configuration. Terraform, by HashiCorp, is the most widely used IaC tool — and for good reason.
Why Terraform?
Terraform works with every major cloud provider (AWS, Azure, GCP) using the same syntax. Your team can review infrastructure changes in pull requests, roll back bad changes with git, and spin up identical environments for dev, staging and production with a single command.
Your First Terraform Config
Here is a minimal example to create an AWS EC2 instance:
terraform {
required_providers {
aws = { source = "hashicorp/aws", version = "~> 5.0" }
}
}
provider "aws" {
region = "ap-south-1"
}
resource "aws_instance" "web" {
ami = "ami-0f5ee92e2d63afc18"
instance_type = "t3.micro"
tags = {
Name = "ekamops-web"
Env = "production"
}
}
Run terraform init, terraform plan (preview changes), then terraform apply to create the resource.
State Management
Terraform tracks what it has created in a state file. Store this remotely (S3 + DynamoDB locking for AWS) so your whole team shares the same view of infrastructure — never locally on someone’s laptop.
Modules: Reusable Infrastructure
Group related resources into modules. A VPC module, an EKS module, an RDS module — each tested, versioned, and reusable across projects. This is where teams unlock the real productivity of IaC.
Need help getting your cloud infrastructure into code? EkamOps can help — we specialise in Terraform migrations for AWS and Azure.