Infrastructure as Code with Terraform
Ad
What is Infrastructure as Code?
Infrastructure as Code (IaC) means managing servers, networks, and cloud resources through code instead of manual clicking. Terraform is the leading IaC tool.
Why IaC?
- Reproducible — spin up identical environments.
- Version controlled — track infra changes in Git.
- Automated — no manual console clicking.
A Terraform Example
provider "aws" {
region = "us-east-1"
}
resource "aws_instance" "web" {
ami = "ami-12345"
instance_type = "t2.micro"
tags = { Name = "WebServer" }
}
The Terraform Workflow
terraform init # download providers
terraform plan # preview changes
terraform apply # create/update infra
terraform destroy # tear it all down
Key Concepts
| Term | Meaning |
|---|---|
| Provider | Cloud platform (AWS, Azure) |
| Resource | Thing to create (server, DB) |
| State | Record of what exists |
FAQs
Terraform vs Ansible?
Terraform provisions infrastructure; Ansible configures it. They complement each other. More in our DevOps guides.
Is Terraform cloud-specific?
No — it works across AWS, Azure, GCP, and more.
