Cloud & DevOps

Terraform vs. Pulumi vs. CloudFormation: Which IaC Tool Should You Use?

Shubham Parmar7 min read
Terraform vs. Pulumi vs. CloudFormation — infrastructure as code decision guide banner

In short: CloudFormation only provisions AWS resources, so it's out if you run (or might run) more than one cloud. Terraform and Pulumi both reach AWS, Azure, GCP, and Kubernetes — the real decision between them is whether you want infrastructure written in HCL, a language built just for this, or in a general-purpose language like TypeScript, Python, or Go that your team already uses for everything else.

What this means for you

  • All-in on AWS with no plans to leave it: CloudFormation removes a moving part (no separate state backend to manage) for zero extra tool cost.
  • Multi-cloud or hybrid, team is comfortable with a dedicated config language: Terraform, with the largest module ecosystem and hiring pool.
  • Multi-cloud, team wants real loops, types, and existing test tooling instead of a DSL: Pulumi.

Every "best IaC tool" roundup eventually admits there isn't one — the right answer depends on which cloud(s) you're actually running and how your team prefers to write configuration. Here's what each tool actually trades off.

What each tool actually is

Terraform

Terraform is HashiCorp's declarative infrastructure-as-code tool, configured in HCL (HashiCorp Configuration Language) — a syntax built specifically for describing resources, not a general programming language. It supports every major cloud provider plus hundreds of smaller ones through its provider registry, and it's been the default choice for multi-cloud and hybrid infrastructure for years, which means the largest library of community modules and the deepest hiring pool of any tool here.

Pulumi

Pulumi provisions the same kind of infrastructure — AWS, Azure, GCP, Kubernetes — but you write it in TypeScript, Python, Go, C#, or Java instead of a DSL. It has its own deployment engine (it does not compile to CloudFormation or Terraform under the hood); it calls provider APIs directly, the same way Terraform does. State can live in Pulumi's managed service or be self-hosted, similar to Terraform's backend options.

AWS CloudFormation

CloudFormation is AWS's own IaC service, configured in YAML or JSON templates. It only provisions AWS resources, but in exchange it needs no separate state file or backend — AWS tracks stack state internally — and it integrates natively with AWS-specific features like StackSets for multi-account deployment, Change Sets for reviewing updates before applying them, and built-in drift detection.

The differences that actually matter

Multi-cloud reach

This is usually the fastest filter. If you run or plan to run more than one cloud provider, or expect to someday, CloudFormation is eliminated immediately — it simply doesn't provision non-AWS resources. Terraform and Pulumi both cover AWS, Azure, GCP, and Kubernetes from the same tool.

Language and authoring experience

Terraform's HCL is declarative and purpose-built: easier for a platform or SRE team to read uniformly across many files, but limited when you need real conditionals, loops with complex logic, or to share code the way you would in a normal codebase. Pulumi trades that constraint for a general-purpose language — you get your existing linter, test framework, and IDE autocomplete, at the cost of infrastructure code that can vary more in style from one engineer to the next. CloudFormation's YAML/JSON templates are the most verbose of the three and have the least logic of any of them, which is part of why AWS itself built the CDK (Cloud Development Kit) as a higher-level way to generate CloudFormation from code.

State management

Terraform needs an external state backend (commonly an S3 bucket with locking) that your team is responsible for securing and backing up. Pulumi offers the same choice — a managed backend or self-hosted. CloudFormation needs none of that: state lives inside AWS, which is one less piece of infrastructure to operate, but also one less piece you control directly if something about that state needs manual recovery.

Licensing and the OpenTofu fork

HashiCorp moved Terraform from the open-source MPL license to the more restrictive Business Source License in 2023, which prompted the community to fork the last open-source version into OpenTofu, now maintained under the Linux Foundation and still under active development. For most teams this licensing change doesn't bite — it mainly restricts building a competing commercial product directly on top of Terraform — but if that clause matters to you, OpenTofu stays close to a drop-in replacement. Pulumi's SDK is Apache 2.0 licensed, which doesn't carry the same restriction.

Decision framework

SituationReach for
All AWS, no other cloud planned, want the fewest moving partsCloudFormation
Multi-cloud or hybrid, team prefers a dedicated config language, wants the biggest module ecosystemTerraform (or OpenTofu if the license matters to you)
Multi-cloud or Kubernetes-heavy, team wants real programming constructs and existing test toolingPulumi
AWS-only today, but a second cloud is plausible within a year or twoTerraform or Pulumi now, rather than migrating off CloudFormation later

What this looks like in a real migration

The tool choice matters less than most teams expect once you're actually mid-migration. What breaks projects isn't HCL versus TypeScript — it's infrastructure that was never codified in the first place, so there's no source of truth to migrate from, and no safe way to verify the new configuration matches what's actually running in production. That audit step is also where a cloud migration strategy and an IaC rollout tend to happen together rather than as separate projects.

Whichever tool you land on, plan the CI/CD pipeline that applies it at the same time, not after — a CI/CD platform decision and your IaC tool choice both shape how changes get reviewed and rolled back. And once infrastructure is codified, the same visibility that makes drift obvious also makes it much easier to see where cloud spend is actually going, since every resource traces back to a line of configuration instead of a console click no one remembers making.

If you're moving off hand-configured infrastructure, our cloud and DevOps work treats infrastructure as code as part of the migration's design phase, not something bolted on after cutover — the tool is chosen to match your actual environment, not picked before we've seen it.

Frequently asked questions

What's the main difference between Terraform and Pulumi?

Terraform configuration is written in HCL, a declarative domain-specific language built just for describing infrastructure. Pulumi uses general-purpose languages — TypeScript, Python, Go, C#, or Java — so you get real loops, functions, types, and your existing test tooling instead of a DSL's more limited expressiveness. Both compile down to API calls against the same cloud providers; the difference is almost entirely in how you author and maintain the configuration, not what it can provision.

Can CloudFormation deploy to AWS, Azure, and GCP?

No. CloudFormation is an AWS-native service and only provisions AWS resources. If your infrastructure is entirely on AWS, that's not a limitation — it's one less moving part, since state is managed by AWS itself rather than a file you have to store and secure. If you run multi-cloud or expect to, CloudFormation can't be your only tool; you'd need Terraform or Pulumi for the parts outside AWS, or a second tool just for AWS, which is extra complexity most teams avoid.

Is Pulumi better than Terraform?

Neither is strictly better — they trade off differently. Pulumi's general-purpose-language approach gives engineers real programming constructs and plugs into existing CI, linting, and unit-test setups more naturally. Terraform's HCL is less powerful but more constrained, which makes infrastructure code more uniform across a team and easier for non-programmers (SREs, platform teams) to read. Terraform also has a larger module registry and a bigger hiring pool, since it's been the default choice for longer.

What is OpenTofu, and do I need to worry about it?

OpenTofu is an open-source fork of Terraform, created after HashiCorp moved Terraform from the open-source MPL license to the more restrictive Business Source License in 2023. It's maintained under the Linux Foundation and stays compatible with existing Terraform configuration and providers. If you're starting fresh and licensing terms matter to you (for example, you'd otherwise be building a competing commercial product on top of Terraform), OpenTofu is worth evaluating instead of Terraform itself — the migration is close to a drop-in swap for most configurations.

Do I need Terraform or Pulumi if I'm only ever going to use AWS?

Not necessarily. CloudFormation is purpose-built for AWS, costs nothing beyond the resources it creates, and removes the need to manage a separate state backend. Teams pick Terraform or Pulumi over CloudFormation even for AWS-only workloads when they want a bigger module ecosystem, prefer HCL or a real programming language over CloudFormation's YAML/JSON templates, or want one tool ready in case they ever add a second cloud provider.

Sources

Need help putting this into practice?

Tech Programmer builds and ships this work for startups and enterprises. Tell us what you are trying to do and we will tell you what it takes.

Related reading