Pulumi vs Terraform: Providers, Code and Migration Choices

Pulumi vs Terraform is a decision about how your team authors, tests and operates infrastructure. Keep a working Terraform setup when its HCL modules and review process already meet your needs; evaluate Pulumi when language-native libraries or programmatic orchestration would simplify real work. Provider access is less restrictive than a registry-count comparison suggests: Pulumi’s Any Terraform Provider documentation describes direct use of Terraform and OpenTofu providers, including internal provider binaries.

There is also more than one way to adopt Pulumi. Its engine can run HCL, its cloud service can host Terraform state, and its converter can produce a program in another language. Those are different changes with different migration costs. Choose the benefit you need before deciding how much of the existing system to replace.

Google · Preferred Sources

Don't miss new tech stories on Google

Add Tech Insider once in the Google app and our stories appear in your news suggestions.

Add Now

Provider compatibility is a versioned dependency

Start with the resources your application requires and the provider versions that implement them. Pulumi documents a direct-provider route for a service absent from its registry, a privately maintained provider, or a version that its registry has not published. For TypeScript, Python, Go, .NET and Java, the route generates a typed SDK inside the project. YAML uses resource schema tokens instead.

CapabilityTerraformPulumi
Infrastructure authoringHCL configuration and modulesPython, TypeScript, JavaScript, Go, .NET, Java, YAML and HCL
Terraform provider reuseUse the selected provider in the Terraform projectUse a published Pulumi package or add the Terraform provider directly
Reusable infrastructureTerraform modulesPulumi components and direct use of existing Terraform modules
Execution integrationTerraform CLI and managed platform workflowsPulumi CLI, managed deployments and Automation API
Software licenseBusiness Source License 1.1Apache 2.0 for the CLI and SDKs

In an existing Pulumi project, the documented command below adds a specific version of the HashiCorp random provider. The version is a reproducibility example, not a recommendation that every project use that release.

pulumi package add terraform-provider hashicorp/random 3.7.1

The provider installation instructions distinguish the upstream provider version from the version of Pulumi’s terraform-provider wrapper. Both appear in Pulumi.yaml and can be pinned. Keep that file under version control so a workstation and a CI runner reconstruct the same provider selection. A shared registry name without a shared version is insufficient for a reproducible comparison.

Configuration translation is another practical difference. Pulumi provider configuration keys use camelCase even in Python: a field such as oauth_client_id becomes oauthClientId. The documentation says an unrecognized snake_case configuration key is silently ignored. Resource inputs follow the selected language’s naming convention instead, so configuration keys and resource arguments need separate attention during migration.

For an estate spanning several clouds, pair the provider inventory with the actual services selected for the application. The useful question is whether the chosen provider exposes the operations and version you need, with an upgrade process your team can maintain.

Compare the same bucket in HCL and TypeScript

Pulumi’s language and workflow comparison includes HCL alongside general-purpose languages. Choosing TypeScript adds its normal package and testing ecosystem, while choosing Pulumi HCL retains configuration syntax on a different engine. This makes language preference a useful starting point, but not a complete description of the deployment system.

Here are equivalent bucket and versioning declarations. The Terraform example assumes an initialized AWS provider, credentials, a region and a globally suitable bucket name supplied through bucket_name. The TypeScript example assumes an initialized Pulumi project with @pulumi/aws, credentials, a region and a bucketName configuration value. Use separate test names and accounts or environments when evaluating them; do not run both as owners of the same bucket.

variable "bucket_name" {
  type = string
}

resource "aws_s3_bucket" "data_lake" {
  bucket = var.bucket_name
  tags = {
    Environment = "production"
    Team        = "data-engineering"
  }
}

resource "aws_s3_bucket_versioning" "data_lake" {
  bucket = aws_s3_bucket.data_lake.id
  versioning_configuration {
    status = "Enabled"
  }
}

Pulumi’s AWS bucket reference documents the bucket and tag arguments. Its S3 versioning reference now directs users from the deprecated BucketVersioningV2 name to BucketVersioning, used below:

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

const config = new pulumi.Config();
const dataLake = new aws.s3.Bucket("data-lake", {
  bucket: config.require("bucketName"),
  tags: {
    Environment: "production",
    Team: "data-engineering",
  },
});

const versioning = new aws.s3.BucketVersioning("data-lake-versioning", {
  bucket: dataLake.id,
  versioningConfiguration: {
    status: "Enabled",
  },
});

export const bucketName = dataLake.bucket;

The important TypeScript detail is dataLake.id. Pulumi’s inputs and outputs documentation explains that an Output represents a value that can become known after provisioning. Passing it as another resource’s input records a dependency. You are describing a desired relationship, rather than manually waiting for a cloud API call and then launching the next one.

Outputs also need Pulumi’s access and transformation helpers instead of ordinary string printing. That is a concept an application developer still has to learn, even when the surrounding syntax is familiar. The language eliminates some unfamiliar syntax; it does not eliminate infrastructure state, dependencies or provider behavior.

The versioning reference relays AWS’s recommendation to wait 15 minutes after enabling versioning for the first time before issuing object writes or deletes. These examples create the bucket and versioning configuration only. Package installation and service configuration inside machines are another responsibility, covered in the Terraform and Ansible comparison.

Both tools can test without creating a deployment

HashiCorp’s Terraform testing documentation supports a more capable testing model than an integration-tests-only description. A test run defaults to command = apply, which creates real infrastructure. Set command = plan to test configuration logic without creating it. Mocked provider data has been available since Terraform 1.7.0.

Test behaviorTerraformPulumi
Test authoringHCL test files, including .tftest.hclThe program language’s test frameworks
Logic without deploymentPlan-mode tests and optional mocked providersUnit tests mocking Pulumi resource calls
Live infrastructure validationApply-mode test runs against test resourcesIntegration tests against deployed stacks
Cleanup responsibilityTerraform attempts to destroy test-created resources after the test fileThe integration-test workflow must manage the test stack lifecycle

For the Terraform bucket declaration above, a small test can assert that the chosen name reaches the resource argument. Save this as a .tftest.hcl file in the project’s test directory. It demonstrates a plan assertion, not a deployment test or a substitute for checking AWS permissions:

variables {
  bucket_name = "example-iac-comparison-test"
}

run "preserves_bucket_name" {
  command = plan
  assert {
    condition     = aws_s3_bucket.data_lake.bucket == var.bucket_name
    error_message = "The configured bucket name changed unexpectedly."
  }
}

Pulumi’s testing and orchestration documentation describes unit tests that mock resource calls and run without cloud credentials, alongside integration tests that deploy real resources. Its Automation API also lets a host program drive preview, update and destroy operations. That is useful when infrastructure creation is part of an internal service or a more complex test harness.

Choose tests by the failure they should catch. A mocked test can verify the arguments your code emits; a live test can exercise provider permissions and deployment behavior. Passing the former does not exercise the latter. For either tool, compare the same representative infrastructure, refresh behavior and provider versions before drawing a deployment-speed conclusion.

Choose the adoption route before converting code

The Terraform migration guide separates hosting state, running HCL, reusing modules and converting programs. That separation lets a team adopt a useful capability without making every part of the transition at once.

Adoption routeCode and engineState or workflow consequence
Pulumi Cloud as Terraform backendKeep Terraform configuration and CLIMove the backend through Terraform’s remote-backend interface
Pulumi HCLKeep .tf syntax; run Pulumi’s engineImport resources into the selected Pulumi stack
Terraform modules in PulumiConsume existing modules from a Pulumi programRetain module implementation while integrating it into Pulumi
Convert to TypeScript or another languageGenerate and review a new programImport existing resource state separately from conversion
Coexistence through outputsKeep some resources managed by TerraformRead their exported values from Pulumi without taking ownership

Pulumi HCL has specific configuration differences. Its comparison page says backend and required_version settings are accepted but ignored, because Pulumi handles state, while an HCP cloud block is rejected. An HCL project therefore still needs an explicit backend and operating-model decision even when most resource syntax is unchanged.

For a full language conversion, work on a copy of the configuration, pause changes to the selected resources and retain a protected state backup. The original inventory and export commands remain useful:

set -euo pipefail
umask 077
terraform state list
terraform state pull > terraform.tfstate

Keep the exported file out of source control. From the directory containing the copied HCL, convert the code; then, after selecting the intended Pulumi backend and stack, import the saved state and inspect the preview:

pulumi convert --from terraform --language typescript
# Select the intended Pulumi backend and stack before importing.
pulumi import --from terraform ./terraform.tfstate
pulumi preview --diff

Conversion success is not completion. Pulumi documents that the converter can return successfully while leaving notImplemented calls for unsupported constructs. Resolve those and review changed relative file paths before treating the generated program as usable. Importing then connects existing resources to the target stack; it is a separate step from translating source code.

For an HCL project, the corresponding import uses pulumi import --from hcl terraform.tfstate from the directory containing the .tf files. The migration guide says this route imports root-module resources and skips resources nested inside modules with a warning. Account for those separately instead of interpreting a successful command as a complete estate migration.

Review every unexpected replacement or deletion, then transfer scheduled jobs and deployment ownership only after the chosen resource set is represented correctly. Keep the prior state backup under your retention policy. A preview of the intended changes and a documented ownership handover are more useful completion criteria than a fixed migration deadline.

Compare the paid platform and its counting rules

The Terraform repository license specifies Business Source License 1.1 and excludes internal organizational use from its competitive-offering definition. Pulumi describes its CLI and SDKs as Apache 2.0 software. Managed service plans add a separate commercial choice, so compare their collaboration model and billing population alongside the software license.

The Pulumi pricing page offers a free edition for one user with no managed-resource limit. Essentials and Pro introduce base subscriptions and included credits. HashiCorp’s Terraform pricing page publishes resource-based starting prices and their hourly rates:

Managed planBase or starting pricePublished usage terms
Pulumi Free$0; one userNo limit on managed resources
Pulumi Essentials$40/month; 40 creditsUp to 500 managed resources included; listed usage rate $0.1825/resource/month ($0.00025/hour)
Pulumi Pro$400/month; 400 creditsUp to 2,000 managed resources included; usage starts at $0.365/resource/month ($0.0005/hour)
HCP Terraform EssentialsFrom $0.10/resource/monthRated hourly at $0.00013/resource
HCP Terraform StandardFrom $0.47/resource/monthRated hourly at $0.00064/resource
HCP Terraform PremiumFrom $0.99/resource/monthRated hourly at $0.00135/resource

Pulumi says all service usage draws on its credit pool, a credit costs $1, and unused monthly credits expire. Its resource count includes declared provider resources, component resources and stacks; partial resource hours count as full hours. A program containing a component around several cloud objects can therefore have a different billing population from a simple count of those cloud objects.

Keep the included allowance, other service usage and resource inventory visible when comparing a quote. The headline resource rate is useful for additional usage, but it is not a complete monthly bill. There is no reason to pay for a managed tier’s controls before deciding which controls the team will actually use.

The OpenTofu, Terraform and Pulumi comparison broadens the licensing choice. For this pair, the strongest Pulumi case is a specific improvement in authoring, testing or orchestration that survives a representative trial. A mature Terraform setup remains a reasonable choice when those workflows already work well. Provider reproducibility and a manageable adoption path matter more than a popularity percentage.

Sofia Lindström

Sofia Lindström

Security and privacy

Sofia Lindström writes about security and privacy for Tech Insider: software vulnerabilities and the updates that fix them, data breaches, privacy rules and how products handle personal data. She works from vendor advisories, official vulnerability catalogues and the documents behind each story.

View all articles