Pulumi and Terraform both produce the same kind of artifact — a desired state for cloud APIs — and both store state to a backend so future runs converge to that state. The difference is the authoring surface: Terraform uses HCL (a domain-specific language), Pulumi uses TypeScript, Python, Go, .NET, or YAML. That single choice ripples through everything from how you express conditionals to how you test the code. This article frames the decision the way we present it to clients picking IaC for a green-field environment.
How to verify
pulumi version
pulumi stack ls
pulumi preview --diff
pulumi up --yes
pulumi stack output --json
pulumi state delete urn:pulumi:... # surgical state edit
pulumi preview --diff is the operator-side equivalent of terraform plan. The diff is shown per-resource; pulumi up applies. The state lives in Pulumi Cloud by default but can be redirected to S3, Azure Blob, GCS, or a local file with pulumi login.
What’s happening
Terraform and Pulumi both have the same architecture: providers wrap cloud APIs, the engine builds a dependency graph, the engine reconciles desired against actual, the state file records what’s deployed. Terraform’s providers and Pulumi’s providers are largely the same code paths (Pulumi can wrap Terraform providers through a bridge), so the underlying resource coverage is similar.
The differences worth naming:
- Authoring. Terraform’s HCL is declarative-only; control flow goes through
count,for_each, anddynamicblocks. Pulumi gives you real loops, functions, classes, npm/PyPI packages, and a debugger. Net: Pulumi is much more flexible for non-trivial logic; Terraform is much more constrained and therefore more uniform across teams. - Testing. Pulumi code is just code —
vitest/pytestagainst your stack works. Terraform hasterraform test(added in 1.6) but it’s narrower; mocking providers is harder. - Team familiarity. Backend engineers usually pick up Pulumi-in-TypeScript faster than HCL. Infrastructure-only teams often prefer HCL precisely because it constrains the shape of what they write.
- Tooling ecosystem. Terraform’s tooling (Atlantis, Spacelift, Terragrunt, tfsec, terraform-docs) is broader and more mature. Pulumi has its own equivalents but the surface is smaller.
- State backend. Both default to a hosted backend; both let you redirect. Pulumi’s local-file backend is
pulumi login file://. Terraform’s is the default if you don’t configure one. - Cost. Both have free OSS use; both have paid tiers (Terraform Cloud, Pulumi Cloud) for state hosting, RBAC, policy. Pricing models differ, but for most teams either is “low five-figures annually if you pay for the SaaS, free if you self-host state.”
The decision
Pick Terraform / OpenTofu when:
- The team writing IaC is a dedicated platform team that prefers a constrained DSL.
- You want to use the existing Terraform module ecosystem (
terraform-aws-modules/*and so on). - You need Atlantis, Spacelift, or any of the broader Terraform-native tooling.
- The infrastructure shape is mostly static — same resources per environment, parameters change.
- License posture matters and you want the OpenTofu option (see /en/knowledge-base/opentofu-fork-terraform-migration/).
Pick Pulumi when:
- The team writing IaC is mostly backend engineers comfortable in TypeScript/Python/Go.
- The infrastructure has non-trivial logic — generating N resources from a typed config, applying policies based on the result of an HTTP call, anything that fights
countandfor_eachin HCL. - You want real unit tests against the IaC.
- You’re building an internal platform that exposes infrastructure as a library (
new MyApp({ environment: "prod" })). - You want to share code between application and infrastructure (same type definitions, same constants).
Hybrid is real. Some clients use Terraform for the platform layer (networking, IAM, clusters) and Pulumi for tenant-shaped infrastructure (per-customer stack templated from a TypeScript class). Both can read each other’s state outputs through their respective remote-state references.
Operational notes
- State backend choice matters more than tool choice. Both Pulumi Cloud and Terraform Cloud are good SaaS options; both can use S3/GCS/Azure Blob with locking. Picking the backend is a separate decision from picking the tool.
- Provider parity is real-time-fluctuating. Most AWS/GCP/Azure resources are in both. Niche providers (an internal API, a smaller SaaS) may exist in only one. Check before committing.
- Pulumi’s
Componentpattern is the real win. AComponentis a TypeScript class wrapping a set of related resources — the equivalent of a Terraform module, but with a constructor, methods, and inheritance. This is what makes the “platform as a library” pattern practical. - Terraform’s
moduleregistry is the real win. Public modules fromterraform-aws-modules/*save weeks; Pulumi’s package registry is smaller. - Don’t decide by what one engineer prefers. Decide by what the team that maintains the IaC for years will prefer.
Common pitfalls
- Pulumi state in
file://for a production stack. Lose the file, lose the ability to reconcile. Use a real backend. - Terraform
countfor what should befor_each.countreorders on removal; deleting the middle of a list destroys the resources after it. - Pulumi dynamic providers without resource cleanup. Custom resources without a
deleteimplementation pollute state on destroy. - HCL hidden complexity. A clever
for_eachoverflatten(...)can be harder to read than a Python for-loop. The DSL constraint cuts both ways. - Cross-tool state references that don’t exist. Pulumi can read Terraform remote state and vice versa, but only what’s actually published as an output.
We’ve run both Pulumi and Terraform/OpenTofu in production for clients. The operating model — repo layout, PR workflow, policy library, state backend hygiene, drift handling — looks the same in either tool; what changes is the language the dev team writes in. For green-field engagements where the question is open, we walk through the decision factors above and pick deliberately, then run it as part of /en/services/managed-operations/.