Terraform is an infrastructure-as-code tool built by HashiCorp, with a free/open-source core (under the Business Source License) plus a paid Terraform Cloud offering. It ranks #16 among dev tools in usage surveys at roughly 17.8% share. It describes cloud resources โ servers, networks, databases, DNS records, across AWS, Azure, GCP, and dozens of other providers โ in declarative configuration files, so entire environments can be created, versioned, reviewed, and reproduced automatically instead of clicked together by hand.
Terraform configs are written in HCL (HashiCorp Configuration Language) โ this declares a single AWS EC2 instance.
# main.tf
provider "aws" {
region = "us-east-1"
}
resource "aws_instance" "web" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = "t3.micro"
tags = {
Name = "web-server"
}
}
Install the Terraform CLI, then the standard workflow is init โ plan โ apply.
# macOS via Homebrew
brew install hashicorp/tap/terraform
# standard workflow in a directory with .tf files
terraform init
terraform plan
terraform apply