Planfile

Pulumi vs Terraform: what's different, with the same bucket in both

Updated

Pulumi and Terraform are both declarative infrastructure-as-code tools with a preview, a state file and providers for every major cloud. The main difference is the language: Terraform uses HCL, a configuration language, while Pulumi lets you write infrastructure in TypeScript, Python, Go, C#, Java or YAML. Pulumi stores state in Pulumi Cloud by default; Terraform uses a local file or a backend you choose.

A Terraform plan in Planfile replacing an S3 bucket, with -/+ and forces replacement
Terraform's plan. Pulumi's equivalent is pulumi preview, which also marks replacements.

How Pulumi and Terraform are alike

The two tools share more than the Pulumi vs Terraform debate suggests. Both:

A Pulumi program written in Python still isn't a script that calls cloud APIs in order. Running it registers resources with the Pulumi engine, which compares them with state and plans the changes, much like Terraform's core does with HCL.

Pulumi vs Terraform side by side

As of November 2026:

TerraformPulumi
LanguageHCLTypeScript/JavaScript, Python, Go, C#/.NET, Java, YAML; also an HCL language plugin
Preview / deployterraform plan / terraform applypulumi preview / pulumi up
Default stateLocal terraform.tfstatePulumi Cloud
Other state optionsS3, Azure Blob, GCS, HCP Terraform and moreS3, Azure Blob, Google Cloud Storage, S3-compatible stores, PostgreSQL, local files
EnvironmentsWorkspaces, or separate directoriesStacks (dev, prod) with per-stack config
ProvidersTerraform RegistryPulumi Registry; any Terraform or OpenTofu provider can be added
ReuseModulesComponents, plus your language's packages
Testingterraform test (1.6+), check blocks, validationsUnit tests with mocks, property tests, integration tests
LicenceBUSL 1.1 (1.6 and later)Apache 2.0 (engine, CLI and SDKs)
Hosted serviceHCP TerraformPulumi Cloud

Languages: HCL vs TypeScript, Python, Go and more

This is the reason most people look at Pulumi. With a general-purpose language you get the editor support, package manager, test framework and abstractions you already use: classes, functions, loops, conditionals and type checking. An application team writing TypeScript can keep its infrastructure in TypeScript, in the same repository.

Terraform's HCL is deliberately smaller. It has variables, locals, expressions, for_each and count, conditionals and built-in functions, but no arbitrary code. That limits what a configuration can do, which is also its strength: any Terraform file reads the same way, reviewers can follow it without knowing a programming language, and there's less room for clever abstractions that only one person understands.

Pulumi also offers Pulumi YAML for simple, declarative programs, and an HCL language plugin that aims to run Terraform configurations as Pulumi programs. With the HCL plugin, Pulumi doesn't read Terraform state files; existing resources are brought in with pulumi import.

The same S3 bucket in both

Terraform

resource "aws_s3_bucket" "logs" {
  bucket = "example-logs-2026"

  tags = {
    env = "dev"
  }
}

output "bucket_name" {
  value = aws_s3_bucket.logs.id
}
terraform init
terraform plan
terraform apply

Pulumi (TypeScript)

import * as aws from "@pulumi/aws";

const logs = new aws.s3.Bucket("logs", {
    bucket: "example-logs-2026",
    tags: { env: "dev" },
});

export const bucketName = logs.id;

Pulumi (Python)

import pulumi
import pulumi_aws as aws

logs = aws.s3.Bucket("logs",
    bucket="example-logs-2026",
    tags={"env": "dev"})

pulumi.export("bucket_name", logs.id)
pulumi stack init dev
pulumi config set aws:region eu-west-2
pulumi preview
pulumi up

The shapes match: a resource type, a name, and arguments. Two details differ. Pulumi's first argument ("logs") is a logical name; if you leave out bucket, Pulumi auto-names the bucket with a random suffix, which avoids collisions between stacks. Terraform has no auto-naming for buckets unless you use bucket_prefix. And Pulumi keeps per-environment settings such as the region in stack configuration files (Pulumi.dev.yaml), where Terraform uses variables and .tfvars files.

State and backends

Both tools keep state, and both need it protected.

Terraform writes terraform.tfstate locally unless you configure a backend. Teams move it to S3, Azure Blob Storage, Google Cloud Storage or HCP Terraform, with locking. See Terraform state.

Pulumi uses Pulumi Cloud by default, a hosted service that stores state, handles concurrency and shows history. You can self-manage instead with a DIY backend: pulumi login s3://my-state-bucket (or Azure Blob, Google Cloud Storage, S3-compatible stores, PostgreSQL) or pulumi login --local. Pulumi encrypts values marked as secret in state (per-stack keys from Pulumi Cloud by default); in Terraform, state is stored as plain JSON and sensitive values appear in it, so the backend's own encryption and access controls matter.

Providers and ecosystem

Terraform has the larger ecosystem: thousands of providers and modules in the Terraform Registry, and most infrastructure examples, blog posts and Stack Overflow answers are written in HCL.

Pulumi narrows the gap by reusing it. Many Pulumi providers are bridged from Terraform providers, so they cover the same resources. Pulumi's "Any Terraform Provider" feature goes further: pulumi package add terraform-provider hashicorp/random adds a Terraform or OpenTofu provider and generates a typed SDK for it. Pulumi also has native providers (such as azure-native and kubernetes) generated from the cloud's own API specifications.

Terraform modules and Pulumi components fill the same role. Pulumi components can be shared as packages; Terraform modules are reused through the registry, Git or local paths. See Terraform modules.

Testing

Pulumi's documentation describes three styles: unit tests with mocks that run in memory using your language's test framework (Jest, pytest, Go test), property tests built on Pulumi's policy framework that check resources during deployment, and integration tests that deploy short-lived infrastructure and test it.

Terraform has terraform test (1.6+), which runs .tftest.hcl files with run blocks and assertions, against real infrastructure or with command = plan, and supports mocked providers (1.7+). Inside configurations, variable validation, precondition/postcondition and check blocks catch problems at plan or apply time. If your team already lives in a language's test tooling, Pulumi fits it more directly; Terraform's tests stay in HCL.

Learning curve and hiring

For a developer fluent in TypeScript or Python, Pulumi can feel familiar on day one. You still need to learn the concepts that both tools share: resources, dependencies, state, previews, replacements and drift. For ops engineers who don't write much code, HCL is usually quicker to read and review.

Terraform has the larger body of examples and community answers to learn from, and HashiCorp offers the Terraform Associate certification. The concepts move both ways: someone who understands a Terraform plan will understand a Pulumi preview.

Moving from Terraform to Pulumi (or running both)

Pulumi documents several routes, as of November 2026:

Going the other way, from Pulumi to Terraform, means writing HCL and using Terraform's import blocks to adopt the existing resources. Whichever direction, never let two tools manage the same resource: each would see the other's changes as drift and try to undo them.

When to choose Pulumi or Terraform

Starting out? Read what Terraform is, then the Terraform tutorial.

Learn the Terraform side

Planfile teaches Terraform, not Pulumi: lessons and Labs on your iPhone with a simulated AWS provider, so you can write HCL, read plans and work with state without a cloud account. The first two chapters are free.

Questions

Is Pulumi better than Terraform?

It depends on the team. Pulumi suits developers who want general-purpose languages and their tooling; Terraform has the larger ecosystem and a simpler configuration language that is easy to review.

Does Pulumi use Terraform providers?

Many Pulumi providers are bridged from Terraform providers, and Pulumi can add any Terraform or OpenTofu provider with pulumi package add terraform-provider.

Is Pulumi free and open source?

The Pulumi engine, CLI and SDKs are open source under Apache 2.0. Pulumi Cloud, the default state backend, is a hosted service with free and paid tiers; you can self-manage state instead.

Does Pulumi have a state file?

Yes. Pulumi keeps state in Pulumi Cloud by default, or in a backend you manage such as S3, Azure Blob Storage, Google Cloud Storage or a local directory.

Can I convert Terraform to Pulumi?

Yes. pulumi convert --from terraform translates HCL into Pulumi code, pulumi import can bring in resources listed in a .tfstate file, and Pulumi programs can read outputs from existing Terraform state.

Terraform vs Pulumi: which should I learn first?

For most infrastructure jobs, Terraform. Its concepts (state, plans, providers, modules) transfer directly to Pulumi.