Infrastructure as Code: Terraform vs Pulumi vs CloudFormation
I've Run All Three in Production. Here's the Unfiltered Truth.
Terraform since 2017. CloudFormation on AWS-heavy projects since 2019. Pulumi since 2022. Each has a place. Here's my real opinion after running all three at scale.
Terraform: The Industry Standard
Best for: Multi-cloud environments, teams with diverse cloud experience, most hiring managers' expectations.
Strengths: Largest ecosystem of providers (1,000+). Largest community. Most tutorials, most Stack Overflow answers. State management with S3+DynamoDB is battle-tested. Modules are reusable and shareable via Terraform Registry.
Weaknesses: HCL (HashiCorp Configuration Language) is a custom DSL that has limited programming constructs. Loops are awkward. Conditionals are verbose. Testing is harder than it should be. And HashiCorp's license change to BSL in 2023 caused some enterprise concern.
# Terraform example: EC2 with security group
resource "aws_instance" "web" {
ami = data.aws_ami.ubuntu.id
instance_type = var.instance_type
vpc_security_group_ids = [aws_security_group.web.id]
subnet_id = var.public_subnet_id
tags = {
Name = "${var.project}-web"
Environment = var.environment
}
}
Pulumi: Terraform for Developers
Best for: Teams where developers own infrastructure, complex logic requirements, companies wanting to avoid vendor lock-in on IaC tooling.
Strengths: Write infrastructure in real programming languages โ Python, TypeScript, Go, Java. Full language features: loops, conditionals, functions, tests. Excellent developer experience. Growing fast.
Weaknesses: Smaller community than Terraform (though growing). Fewer providers. State managed by Pulumi Cloud by default (can self-host). Steeper learning curve for operations teams unfamiliar with software development.
# Pulumi TypeScript example
const server = new aws.ec2.Instance("web", {
ami: ubuntuAmi.id,
instanceType: "t3.micro",
vpcSecurityGroupIds: [secGroup.id],
tags: {
Name: \Ready to start your journey?
Stop reading and start building. Access scenario-based labs, practice exams, and interview roadmaps today.
Start Practicing Free