Every platform team eventually hits the same fork in the road. Someone opens a pull request with 350 lines of HCL nested inside three for_each maps and conditional dynamic blocks, looks up from the screen, and asks: “Why aren’t we just writing this in TypeScript or Python?”
That exact frustration built Pulumi. Yet years after its launch, search demand for “pulumi alternatives” is climbing while Terraform (and its open-source fork OpenTofu) still power the majority of production cloud landing zones. Why? Because turning infrastructure into real software solves five real engineering problems — and quietly imports five new ones.

This guide skips the marketing slogans and compares how Terraform and Pulumi actually behave in production: side-by-side code, what happens under the hood (tf-bridge), real SaaS pricing, how AI coding agents handle both, and a clear decision matrix.
(Already using HCL and wondering about the licensing split? Read OpenTofu vs Terraform first, or check Ansible vs Terraform if you are separating provisioning from configuration management.)
Two Philosophies: Constrained Spec vs. General-Purpose Code
The difference between Terraform and Pulumi is not syntax — it is what the language intentionally forbids.
Terraform uses HCL (HashiCorp Configuration Language), a declarative domain-specific language. You cannot import an HTTP client, read a database mid-run unless there is a data source for it, or write a recursive helper function. That limitation is a feature: every .tf file is essentially a typed graph of desired state. When an engineer reviews a pull request, they know nothing unexpected can execute during plan.
Pulumi uses general-purpose programming languages — TypeScript/JavaScript, Python, Go, C#, Java, or YAML. Your infrastructure is a real program executed by a language runtime (Node.js, Python, Go). You get if/else, for loops, classes, npm/PyPI packages, IDE autocomplete, and real unit tests before a single cloud API call happens.

Look closely at the bottom layer of that diagram. It reveals the detail most comparison posts gloss over: the tf-bridge.
Side-by-Side Example: S3 Bucket + Encryption + Multi-Environment Loop
To see where each tool shines, let’s build the exact same production slice: a private, versioned, KMS-encrypted S3 bucket per environment (staging, prod) with strict public-access blocks.
Terraform (HCL)
variable "environments" { type = set(string) default = ["staging", "prod"]}
resource "aws_s3_bucket" "artifacts" { for_each = var.environments bucket = "acme-artifacts-${each.key}"
tags = { Environment = each.key ManagedBy = "terraform" }}
resource "aws_s3_bucket_versioning" "artifacts" { for_each = aws_s3_bucket.artifacts bucket = each.value.id
versioning_configuration { status = "Enabled" }}
resource "aws_s3_bucket_public_access_block" "artifacts" { for_each = aws_s3_bucket.artifacts bucket = each.value.id block_public_acls = true block_public_policy = true ignore_public_acls = true restrict_public_buckets = true}Pulumi (TypeScript)
import * as aws from "@pulumi/aws";
const environments = ["staging", "prod"] as const;
export const bucketNames = environments.map((env) => { const bucket = new aws.s3.BucketV2(`artifacts-${env}`, { bucket: `acme-artifacts-${env}`, tags: { Environment: env, ManagedBy: "pulumi" }, });
new aws.s3.BucketVersioningV2(`artifacts-ver-${env}`, { bucket: bucket.id, versioningConfiguration: { status: "Enabled" }, });
new aws.s3.BucketPublicAccessBlock(`artifacts-pab-${env}`, { bucket: bucket.id, blockPublicAcls: true, blockPublicPolicy: true, ignorePublicAcls: true, restrictPublicBuckets: true, });
return bucket.bucket;});At 30 lines, they look almost identical. The divergence starts at 3,000 lines:
- Where Pulumi wins: If you want to wrap those three resources into a reusable
SecureArtifactBucketclass with strict TypeScript interfaces, share theenvironmentsenum directly with your backend app, or run Jest/Pytest mocks in 200ms without touching AWS, Pulumi feels effortless. Terraform modules require separate directories, boilerplatevariables.tf/outputs.tffiles, andterraform testis still much younger. - Where Terraform wins: Six months later, a junior engineer opens the Pulumi repo and has to debug a TypeScript upgrade, broken transitive
npmdependencies, or an engineer who got “clever” with dynamic promises (pulumi.all([...]).apply(...)) that makepulumi previewhard to trace. In Terraform,for_eachis ugly — and that ugliness stops people from building overly clever abstractions.
HCL’s lack of expressiveness is a guardrail. Real programming languages remove that guardrail — which feels liberating on day one and demands strict code-review discipline by year two.
Licensing, State Backends, and Real Pricing
Both tools let you run completely for free if you host your own state in Amazon S3, Google Cloud Storage, or Azure Blob Storage (and run plan/apply in GitHub Actions, GitLab CI, or Atlantis). The differences show up when you look at licensing and managed SaaS platforms.
| Dimension | Terraform | OpenTofu | Pulumi |
|---|---|---|---|
| License | BUSL 1.1 (source-available, IBM/HashiCorp) | MPL-2.0 (OSI open-source, Linux Foundation) | Apache-2.0 (CLI & SDKs) |
| Language | HCL (declarative) | HCL (declarative) | TypeScript, Python, Go, C#, Java, YAML |
| Free Self-Hosted State | S3, GCS, Azure Blob, Postgres, GitLab | S3, GCS, Azure Blob (+ native state encryption) | S3, GCS, Azure Blob (loses Pulumi Cloud UI) |
| Managed Cloud Free Tier | HCP Terraform Free (up to 500 resources) | N/A (use Spacelift, env0, Scalr, GitLab) | Pulumi Cloud Free (1 user, 500 workflow min/mo) |
| Managed Team / Pro | Essentials approx. $0.10, Standard approx. $0.47, Premium approx. $0.99 / resource / mo | Vendor-dependent (usually per-seat or runner) | Essentials $40/mo (500 resources), Pro $400/mo (2,000 resources) |
| Policy as Code | Sentinel (paid) or OPA / Checkov | OPA / Kyverno / Checkov | CrossGuard (TS/Python/OPA) |
| Programmatic Embedding | CLI wrapper / CDKTF | CLI wrapper | First-class Automation API |
Two pricing traps catch teams off guard:
- Pulumi Cloud defaults to SaaS state. When a developer runs
pulumi upfor the first time, state goes to Pulumi Cloud. Moving from 1 developer to a team pushes you to Essentials ($40/mo for 40 credits covering up to 500 resources) or Pro ($400/mo for 2,000 resources, SSO, and drift detection), with overages roughly $0.18–$0.37 per extra resource/month. You can switch topulumi login s3://my-state-bucket, but you give up Resource Search, the web diff UI, and Pulumi Deployments. - HCP Terraform scales steeply on Premium. Essentials (approx. $0.10/resource/mo) is cheap, but features enterprises actually want — Terraform Stacks, Sentinel policy enforcement, and higher concurrency — sit in Standard (approx. $0.47/resource/mo) and Premium (approx. $0.99/resource/mo). If your cluster spawns 1,500 Kubernetes/AWS resources, your IaC bill becomes a real line item.

The New Factor: AI Coding Agents and IaC
With tools like Claude Code, Cursor, and Copilot writing a growing share of infrastructure code, readability during human review matters more than typing speed.
- Terraform / HCL is remarkably safe for AI generation. Because HCL has no arbitrary side effects, an LLM cannot accidentally hide an HTTP fetch or a mutable loop bug inside a resource block. Reviewing a 100-line AI-generated
.tfdiff takes seconds. - Pulumi (TypeScript / Python) benefits from compiler and type feedback. An AI agent writing Pulumi TypeScript immediately catches misspelled property names and type mismatches via
tscbefore even runningpulumi preview. On the flip side, you must review that the agent didn’t introduce fragile async.apply()chains or pull in unnecessary packages.
Migrating Without Rebuilding Production
If you are already on Terraform and want to test Pulumi — or vice versa — you do not have to tear down production:
- Convert HCL to Pulumi:
pulumi convert --from terraform --language typescripttranslates.tffiles into clean TypeScript, Python, or Go scaffolding. - Import existing resources:
pulumi import aws:s3/bucketV2:BucketV2 my-bucket acme-artifacts-prod(just like Terraform’simport {}blocks) adopts live cloud resources into state without recreating them. - Bridge state gradually: Pulumi’s
terraform.state.RemoteStateReferencereads outputs directly from an existing Terraform S3/GCS/HCP state file, letting new Pulumi microservices consume VPCs and subnets still managed by Terraform.
The Bottom Line: Which One Should You Pick?

Choose Terraform (or OpenTofu) if:
- A dedicated DevOps or Platform Engineering team owns shared landing zones, networking, and compliance.
- You want strict declarative guardrails so pull requests stay boring, predictable, and easy to audit.
- You rely on the massive ecosystem of off-the-shelf Terraform modules, Atlantis/GitLab CI workflows, or want zero vendor lock-in via OpenTofu’s MPL-2.0 license and native state encryption.
Choose Pulumi if:
- Product engineers (writing TypeScript, Python, or Go every day) own their own cloud infrastructure and hate context-switching into HCL.
- You need real unit testing, IDE refactoring, and shared types between application code and infrastructure.
- You are building an Internal Developer Platform (IDP) or SaaS control plane where Pulumi’s Automation API lets your backend spin up cloud environments programmatically without shelling out to a CLI.
For most infrastructure teams, Terraform or OpenTofu remains the safest default for core cloud foundations, while Pulumi is unbeatable when infrastructure truly needs to behave like application software.





