Infrastructure as Code: Terraform vs Pulumi vs OpenTofu vs CDK

Manually clicking through cloud consoles to create infrastructure is unsustainable. It is slow, error-prone, undocumented, and impossible to reproduce. Infrastructure as Code (IaC) tools solve this by defining infrastructure in configuration files that can be version-controlled, reviewed, tested, and applied consistently.

The IaC landscape has shifted significantly in the past two years. HashiCorp changed Terraform's license from open source to BSL, spawning OpenTofu as a fork. Pulumi has matured into a serious alternative. AWS CDK has evolved beyond an AWS-only tool. Choosing the right IaC tool now requires understanding not just features but also licensing and community dynamics.

Terraform

Terraform remains the most widely adopted IaC tool. According to HashiCorp, Terraform manages infrastructure across 3,000+ providers using a declarative configuration language called HCL (HashiCorp Configuration Language).

Strengths

Limitations

Best for: Teams wanting the largest provider ecosystem and the most community resources.

Pricing: Open source (BSL). Terraform Cloud free tier available. Team plans from $20/user/month.

OpenTofu

OpenTofu is a community fork of Terraform created in response to the BSL license change. Managed by the Linux Foundation, OpenTofu aims to maintain an MPL-licensed (truly open source) alternative that is compatible with Terraform.

Strengths

Limitations

Best for: Teams that want Terraform's capabilities without the BSL license, and organizations with open-source policies.

Pricing: Free and open source.

Pulumi

Pulumi takes a different approach — instead of a domain-specific language like HCL, you define infrastructure using general-purpose programming languages: TypeScript, Python, Go, C#, Java, or YAML.

Strengths

Limitations

Best for: Development teams that want infrastructure code in the same languages as their application code, with testing and type safety.

Pricing: Free tier (individual). Team at $50/month. Business at $225/month. Enterprise pricing available.

AWS CDK

AWS CDK (Cloud Development Kit) lets you define AWS infrastructure using TypeScript, Python, Java, C#, or Go. It synthesizes CloudFormation templates from your code.

Strengths

Limitations

Best for: Teams fully committed to AWS that want high-level abstractions with managed state.

Pricing: Free. CloudFormation itself is free (you pay for the resources it creates).

Other Notable Options

Crossplane

Crossplane manages infrastructure using Kubernetes custom resources. If your team already thinks in Kubernetes, Crossplane lets you manage cloud resources using kubectl and Kubernetes manifests.

Best for: Platform teams building internal developer platforms on Kubernetes.

SST (Serverless Stack)

SST provides a modern framework for building serverless applications on AWS, with infrastructure defined in TypeScript. It focuses on the developer experience of building and deploying serverless apps rather than general-purpose infrastructure.

Best for: Teams building serverless applications on AWS.

Ansible

Ansible handles configuration management and application deployment rather than infrastructure provisioning. While it can create cloud resources, it is better suited for configuring servers, deploying applications, and managing operational tasks.

Best for: Server configuration and application deployment (often used alongside Terraform for provisioning).

Decision Framework

Choose Terraform if:

Choose OpenTofu if:

Choose Pulumi if:

Choose AWS CDK if:

Migration Considerations

Switching IaC tools is not trivial. Key considerations:

For most teams, the pragmatic choice is to use the new tool for new infrastructure and migrate existing infrastructure gradually rather than attempting a big-bang migration.

The IaC tool you choose matters less than the practice of defining infrastructure as code. Any of these tools is vastly better than manual cloud console operations. Pick the one that matches your team's skills and constraints, and invest in the practice.