Dev tools
Terraform vs Pulumi: Which IaC Tool to Pick
Terraform vs Pulumi: HCL vs real programming languages, state, providers, testing, licences, OpenTofu, side-by-side code and which IaC tool fits your team.
In Terraform vs Pulumi, both tools do the same job: you describe cloud infrastructure in code, preview the changes, and the tool creates, updates or deletes real resources to match. The core difference is the language. Terraform uses HCL, a purpose-built configuration language that is deliberately simple and declarative. Pulumi lets you write infrastructure in general-purpose languages such as TypeScript, Python, Go, C# or Java, with loops, functions, classes, packages and your usual test tools.
Terraform has the larger ecosystem, more examples and more people who already know it. Pulumi fits teams that would rather use the languages and tooling they already have, and want to build higher-level abstractions in real code. Licensing has also shaped the choice since Terraform moved to a source-available licence in 2023, giving rise to the open-source fork OpenTofu. This guide compares the two on language, state, providers, testing, licensing and cost, shows the same resource in both, and ends with clear picks.
Terraform vs Pulumi at a Glance
| Terraform | Pulumi | |
|---|---|---|
| Maker | HashiCorp (an IBM company since February 2025) | Pulumi Corporation |
| Language | HCL (HashiCorp Configuration Language) | TypeScript, JavaScript, Python, Go, .NET (C#, F#), Java, YAML and HCL |
| Style | Declarative configuration | Declarative resource model, written in imperative languages |
| Licence | Business Source License 1.1 since August 2023 (previously MPL 2.0) | Apache 2.0 for the open-source engine and SDKs |
| Open-source fork | OpenTofu, under the Linux Foundation | Not needed |
| State | State file in a backend you choose (S3, Azure Storage, GCS, HCP Terraform and others) | Pulumi Cloud by default, or self-managed backends (S3, Azure Blob, GCS, local) |
| Providers | Very large registry of providers and modules | Native providers plus bridged Terraform providers |
| Testing | terraform test, plan checks, external tools | Unit and integration tests in the language's own test frameworks |
| Secrets | Marked sensitive; protect the state file | Secrets encrypted in state by default |
| Managed service | HCP Terraform (formerly Terraform Cloud), Terraform Enterprise | Pulumi Cloud |
| Learning curve | Learn HCL (small) | Know a supported language already |
What Is Terraform?
Terraform, released by HashiCorp in 2014, is the most widely used infrastructure-as-code tool. You write .tf files in HCL that declare resources, run terraform plan to see what will change, and terraform apply to make it so. Terraform keeps a state file that maps your code to real resources, and talks to each cloud or service through a provider plugin.
Its strengths are a huge ecosystem, a simple and readable language, and vast amounts of documentation, examples and hiring pool. Our overview of infrastructure as code covers the wider category, and Terraform vs Ansible compares it with configuration management.
What Is Pulumi?
What is Pulumi? It's an infrastructure-as-code platform, open-sourced in 2018, that lets you define infrastructure in general-purpose programming languages. Your program declares resources as objects; when you run pulumi preview and pulumi up, Pulumi's engine compares the desired state with the current state and plans the changes, much like Terraform.
Because the code is a real program, you can use loops, conditionals, functions, classes, package managers, IDE autocompletion and type checking. Pulumi also offers an Automation API, which lets you drive deployments from your own application code, for example to create an environment per customer from an internal platform.
The Same Resource in Both
An S3 bucket with versioning, created once per environment.
Terraform (HCL):
variable "environments" {
default = ["dev", "staging", "prod"]
}
resource "aws_s3_bucket" "logs" {
for_each = toset(var.environments)
bucket = "acme-logs-${each.key}"
tags = { env = each.key }
}
resource "aws_s3_bucket_versioning" "logs" {
for_each = aws_s3_bucket.logs
bucket = each.value.id
versioning_configuration { status = "Enabled" }
}Pulumi (TypeScript):
import * as aws from "@pulumi/aws";
const environments = ["dev", "staging", "prod"];
for (const env of environments) {
const bucket = new aws.s3.Bucket(`logs-${env}`, {
bucket: `acme-logs-${env}`,
tags: { env },
});
new aws.s3.BucketVersioning(`logs-${env}-versioning`, {
bucket: bucket.id,
versioningConfiguration: { status: "Enabled" },
});
}For a simple case like this, both are similar in length and clarity. The difference grows with complexity. Pulumi's TypeScript can wrap this pattern in a reusable class, publish it as an npm package and unit test it with Jest. Terraform would use a module, which is simpler to read but limited to what HCL expressions allow.
Terraform vs Pulumi: Language and Abstraction
This is the heart of the decision.
| HCL (Terraform) | General-purpose languages (Pulumi) | |
|---|---|---|
| Readability for non-developers | High: looks like configuration | Depends on the language and how the code is written |
| Loops and conditions | for_each, count, conditional expressions | Full language features |
| Reuse | Modules | Functions, classes, packages, component resources |
| Type checking and autocompletion | Good editor support for HCL | Full IDE support in typed languages |
| Risk of over-engineering | Low; the language limits cleverness | Higher; real code invites complexity |
| Sharing with app developers | They must learn HCL | They can use a language they already know |
HCL's limits are partly a feature: infrastructure code stays predictable and easy to review. Pulumi's power is genuine but needs discipline: the same coding standards, reviews and tests you'd apply to application code.
State, Backends and Secrets
Both tools track deployed resources in state. Lose or corrupt it and the tool no longer knows what it manages.
- Terraform stores state in a backend you configure. Remote backends with locking (an S3 bucket with locking, Azure Storage, Google Cloud Storage, or HCP Terraform) are standard for teams. Sensitive values can appear in state, so the state store must be protected.
- Pulumi uses Pulumi Cloud by default, which handles state, locking, history and secrets, or a self-managed backend such as S3, Azure Blob Storage or Google Cloud Storage. Values marked as secrets are encrypted in state, with keys from Pulumi Cloud or your own key service.
Providers and Ecosystem
Terraform's provider registry is the largest in infrastructure as code, covering the major clouds and a long tail of SaaS products, databases and network devices. Its public module registry adds ready-made building blocks.
Pulumi offers its own providers and can use Terraform providers through a bridge, which gives it broad coverage. For the largest clouds it also has "native" providers generated directly from the cloud APIs. In practice, coverage is rarely the deciding factor for mainstream services; for niche providers, check that the Pulumi package exists and is maintained.
Testing and Policy
| Capability | Terraform | Pulumi |
|---|---|---|
| Unit tests | terraform test with mocked providers | Language test frameworks (Jest, pytest, Go test) with mocks |
| Integration tests | terraform test, Terratest (Go) | Language frameworks; Automation API for ephemeral stacks |
| Plan review | terraform plan output in pull requests | pulumi preview output in pull requests |
| Policy as code | Sentinel (commercial), Open Policy Agent | Pulumi policy packs (CrossGuard), Open Policy Agent |
Teams with strong software testing habits often find Pulumi's approach natural. Terraform's testing has improved substantially and is enough for most needs.
Terraform vs Pulumi vs OpenTofu
On Terraform vs Pulumi vs OpenTofu: in August 2023 HashiCorp moved Terraform and its other products from the open-source Mozilla Public License 2.0 to the source-available Business Source License 1.1. The BSL permits most internal use but restricts offering competing commercial products. In response, the community forked the last open-source Terraform as OpenTofu, now hosted by the Linux Foundation under MPL 2.0. IBM completed its acquisition of HashiCorp in February 2025.
| Terraform | OpenTofu | Pulumi | |
|---|---|---|---|
| Licence | BSL 1.1 | MPL 2.0 (open source) | Apache 2.0 (open source) |
| Language | HCL | HCL (compatible with Terraform at fork time; diverging features since) | General-purpose languages, YAML, HCL |
| Governance | HashiCorp / IBM | Linux Foundation | Pulumi Corporation |
| Migration from Terraform | — | Usually a drop-in replacement for existing code | Convert code, or import existing resources |
For most companies using Terraform internally, the licence change has no practical effect. It matters if you build a product that offers Terraform-like functionality, or if your organisation requires open-source licences. OpenTofu is the lowest-effort path for teams that want to stay with HCL under an open-source licence.
Pulumi vs Terraform for Your Team
On Pulumi vs Terraform, team background decides more than features:
| Team situation | Better fit | Why |
|---|---|---|
| Platform or ops team, mixed backgrounds | Terraform (or OpenTofu) | HCL is quick to learn and easy to review |
| Developers own their infrastructure | Pulumi | Same language and tools as the application |
| Large existing Terraform codebase | Terraform or OpenTofu | Migration cost rarely pays off |
| Building an internal developer platform with self-service environments | Pulumi | Automation API and real abstractions |
| Need the widest hiring pool and examples | Terraform | More people know it |
| Organisation requires open-source licences | OpenTofu or Pulumi | Terraform is now source-available |
| Heavy use of complex logic across many environments | Pulumi | Full programming constructs |
Is Pulumi Better Than Terraform?
Is Pulumi better than Terraform? The usual question, Pulumi vs Terraform which is better, has no single answer: neither is better in general. Pulumi is better for teams that think in code, want real abstractions and testing, and prefer to avoid learning a separate language. Terraform is better for teams that value a simple, constrained language, the largest ecosystem and the most familiar tool in the industry.
A practical way to decide: build the same small but real piece of infrastructure, such as a VPC, a database and a service, in both, and ask the people who will maintain it which they'd rather read in a year.
Migrating Between Them
- Terraform to OpenTofu: usually straightforward for existing code; test with your providers and backend first.
- Terraform to Pulumi:
pulumi convert --from terraformtranslates HCL into a Pulumi program in your chosen language, and existing resources can be imported into Pulumi state. Recent Pulumi versions can also run HCL directly. Migrate one stack at a time. - Coexistence: many organisations run both, for example Terraform for shared network and account foundations and Pulumi for application-team stacks, reading outputs across tools.
A Typical Team Workflow
The day-to-day workflow is nearly identical in both tools:
| Step | Terraform | Pulumi |
|---|---|---|
| Change code in a branch | Edit .tf files | Edit the program |
| Open a pull request | CI runs terraform fmt, validate and plan | CI runs linting, unit tests and pulumi preview |
| Review | Reviewers read the plan output | Reviewers read the preview output |
| Merge | CI runs terraform apply against the reviewed plan | CI runs pulumi up |
| Environments | Workspaces, directories or separate state per environment | Stacks (for example dev, staging, prod) with per-stack config |
| Drift | terraform plan shows differences from reality | pulumi refresh and preview show differences |
Whichever tool you use, the essentials are the same: run changes only from CI, review every plan or preview, keep state remote and locked, and give each environment its own state. Drift, where someone changes resources by hand in the cloud console, is the most common source of surprises; scheduled plans or previews that alert on differences catch it early.
Cost
Both open-source command-line tools are free. Costs come from the managed services:
- HCP Terraform and Terraform Enterprise add remote runs, state, policy and governance on paid tiers, with a free tier for small teams.
- Pulumi Cloud has a free individual tier and paid team and enterprise tiers, priced by usage.
- Self-managing state (for example in an S3 bucket) avoids subscription costs for both, at the price of building your own pipelines, access control and policy checks.
Whichever tool you choose, good tagging and reviews of plans help control cloud spend. Our guide to cloud cost optimization covers the bill itself.
Writing Infrastructure Code With AI Assistants
AI coding assistants write both HCL and Pulumi programs well, because both have large amounts of public examples. Pulumi benefits from the assistants' strength in mainstream languages and type checking; Terraform benefits from its simple, repetitive syntax. In both cases the safety net is the same: never apply generated code without reading the plan or preview, check resource names and permissions, and keep policy checks in CI so a confident but wrong suggestion can't reach production.
Common Mistakes
- Choosing on features alone instead of who will maintain the code.
- Over-abstracting in Pulumi, so nobody can tell what infrastructure a change will create.
- Copy-pasting Terraform instead of using modules.
- Unprotected state files containing secrets.
- No plan review in pull requests.
- Migrating a large, working codebase without a clear benefit.
FAQ
Can Pulumi use Terraform providers?
Yes. Pulumi can use Terraform providers through its bridge, in addition to its own native providers.
Is Pulumi free?
The open-source Pulumi engine and SDKs are free under Apache 2.0. Pulumi Cloud has a free tier and paid plans; you can also self-manage state.
Is Terraform still open source?
No. Since August 2023, Terraform is under the Business Source License, which is source-available rather than open source. OpenTofu is the open-source fork.
Which is easier to learn?
For people new to programming, Terraform's HCL is usually easier. For developers fluent in TypeScript, Python or Go, Pulumi feels familiar immediately.
Can I use Terraform and Pulumi together?
Yes. Many teams use both, sharing outputs between stacks, and Pulumi can read Terraform state outputs.