Skip to content

Terraform vs OpenTofu vs Pulumi: Infrastructure as Code Compared

Terraform, OpenTofu, and Pulumi compared: HCL vs general-purpose languages, BUSL vs Apache 2.0, and self-hosted vs managed state backends for infrastructure as code.

Logos of Terraform, OpenTofu, and Pulumi.
Terraform logo (HashiCorp) · OpenTofu logo (Linux Foundation) · Pulumi logo. Composite: techshooked.

Infrastructure as code is a DevOps practice that defines and provisions cloud resources through machine-readable configuration files rather than through manual processes or interactive interfaces. Three tools dominate this space today: Terraform, OpenTofu, and Pulumi. They share the same core goal but differ sharply on configuration language, licensing, and how they handle state. The right choice depends on your team's language preferences, open source requirements, and tolerance for vendor-managed services.

What Infrastructure as Code Tools Actually Do

Infrastructure as code (IaC) tools treat cloud resource definitions the same way software teams treat application code: version-controlled, peer-reviewed, and reproducible across environments. Instead of clicking through a cloud console to spin up a virtual machine or configure a load balancer, you describe the desired state in a file, and the tool reconciles that description with what is actually running. Provider plugins bridge the gap between the IaC tool and the underlying cloud API, whether that is AWS, Azure, GCP, or a dozen SaaS platforms.

Terraform and OpenTofu take a declarative approach: you describe the end state, and the tool determines what changes to make. Pulumi takes a different path, letting teams write infrastructure definitions in the same general-purpose language they use for application code. The definition list below frames the core distinction.

Declarative IaC (Terraform, OpenTofu)
You write the desired state; the tool computes the diff and applies only the necessary changes. Configuration is expressed in HashiCorp Configuration Language (HCL) or JSON. The tool owns the execution logic.
Imperative / general-purpose IaC (Pulumi)
You write code in Python, TypeScript, Go, or another supported language that constructs the desired state programmatically. Loops, conditionals, and abstractions from your host language are available natively, without HCL workarounds.
Provider plugin
A separately versioned binary that translates IaC resource definitions into API calls for a specific cloud or SaaS platform. Provider plugins have independent release cycles from the core IaC CLI in all three tools.

A broader survey of the infrastructure as code tools landscape covers additional options beyond these three, but these three tools represent the most widely adopted paths for teams starting or standardizing their IaC practice.

Terraform: The Established Standard

Terraform is the most widely deployed infrastructure as code tool across enterprise and startup environments. HashiCorp's install page lists the latest stable release (developer.hashicorp.com/terraform/install), a minor release in the stable v1.0 series that honors the v1.0 compatibility promises. Configurations are written in HashiCorp Configuration Language (HCL), a declarative syntax designed to be readable by both humans and machines. Each HCL configuration describes resources, and the CLI reconciles that description with live cloud state through five main commands: init, validate, plan, apply, and destroy (developer.hashicorp.com/terraform/cli/commands).

Diagram showing the Terraform logo in the center, connected to various icons representing different functionalities.
Credit: HashiCorp

The licensing situation is the most consequential constraint for teams evaluating Terraform. Its CLI is distributed under the Business Source License (BUSL), which restricts certain competitive commercial uses, as documented on Pulumi's comparison page (pulumi.com/docs/iac/comparisons/terraform/). For teams with an open source mandate or those building tooling that competes with HashiCorp's offerings, BUSL is the primary reason to evaluate OpenTofu instead.

Terraform's strengths on a practical level:

  • Mature HCL ecosystem with thousands of community modules in the Terraform Registry
  • Terraform Cloud and Enterprise provide a managed state backend, remote execution, and policy enforcement
  • Broad provider plugin coverage across AWS, Azure, GCP, Kubernetes, and hundreds of SaaS APIs
  • The v1.0 compatibility promise keeps HCL syntax and provider plugin interfaces stable across minor releases
  • Extensive CI/CD integration patterns with GitHub Actions, GitLab CI, and Jenkins

Teams already invested in HCL and without a conflicting open source policy will find Terraform the lowest-friction option. Those who need open source governance should read the next section before committing. For teams weighing it against configuration-management tools, the Terraform compared to Ansible and CloudFormation comparison covers those trade-offs in depth.

OpenTofu: The Community Fork

OpenTofu is a community-driven infrastructure as code fork of Terraform, launched after HashiCorp switched its CLI from the Mozilla Public License to the Business Source License. The fork launched with backing from Harness, Gruntwork, Spacelift, env0, Scalr, and others, and is stewarded by the Linux Foundation. It remains fully open source under the Mozilla Public License and presents itself as a drop-in replacement for Terraform, preserving existing HCL syntax and provider plugin compatibility.

OpenTofu 1.12 documentation landing page with Getting started, Language, CLI Documentation and Internals cards
Credit: OpenTofu

OpenTofu v1.9 introduced a -exclude flag for selectively excluding resources from a plan or apply operation, along with dynamic provider configuration generation using for_each. Client-side state encryption with multiple key providers, including PBKDF2, AWS KMS, GCP KMS, and OpenBao, arrived earlier in v1.7. These additions signal that OpenTofu is developing its own feature track rather than waiting for upstream changes (OpenTofu 1.9.0 release; state encryption docs).

OpenTofu practical highlights:

  • Fully open source under the Mozilla Public License, with Linux Foundation governance providing long-term stewardship assurance
  • Drop-in replacement for Terraform: same HCL syntax, same provider plugin blocks, same init/plan/apply/destroy workflow
  • OpenTofu Registry inherits the provider and module ecosystem, with figures on the homepage listing 3,900+ providers and 23,600+ modules (figures as presented on opentofu.org and subject to change)
  • Client-side state encryption is a security feature Terraform does not offer in its open source tier
  • v1.x compatibility promises keep HCL syntax and provider plugin interfaces stable within the OpenTofu 1.x series

The key migration caveat: OpenTofu and Terraform now run on separate release tracks. Configurations written for one may diverge as each tool adds features the other does not implement. Teams should treat them as parallel paths rather than perpetually interchangeable binaries.

Pulumi: Infrastructure in General-Purpose Languages

Pulumi takes a different approach to infrastructure as code: instead of learning HCL, engineers write infrastructure definitions in the general-purpose language their team already uses. Supported languages include Python, TypeScript, JavaScript, Go, .NET, Java, and YAML, as documented on Pulumi's comparison page (pulumi.com/docs/iac/comparisons/terraform/). The Pulumi CLI and SDKs are open source under the Apache License; Pulumi Cloud is the commercial layer that adds managed state, secrets management, RBAC, audit logs, and policy management for teams running Pulumi at organizational scale.

State management in Pulumi is flexible. Pulumi Cloud provides a fully managed state backend. Self-hosted options include AWS S3, Azure Blob Storage, Google Cloud Storage, and a local filesystem backend. The state backend choice is independent of the language choice and can be switched without re-writing infrastructure code (pulumi.com/docs/iac/concepts/state-and-backends/).

Pulumi practical highlights:

  • Write infrastructure in Python, TypeScript, Go, or another supported general-purpose language, no HCL required
  • Native language constructs: loops, functions, conditionals, and classes apply directly to infrastructure logic
  • Pulumi Registry provides provider plugin coverage across AWS, Azure, GCP, Kubernetes, and SaaS platforms
  • Pulumi Cloud adds managed state, RBAC, audit logging, and policy as code for enterprise teams
  • Self-hosted state backend options (S3, Azure Blob, GCS, local) keep Pulumi viable without a commercial subscription
  • CLI and SDKs licensed under the Apache License, placing the core toolchain firmly in open source territory

Side-by-Side Comparison: Language, Licensing, and State

The table below compares Terraform, OpenTofu, and Pulumi across the five axes that most frequently determine tool selection: configuration language, license, state backend options, provider ecosystem, and primary differentiator.

AxisTerraformOpenTofuPulumi
Config languageHCL (declarative)HCL (declarative)Python, TypeScript, Go, .NET, Java, JS, YAML (general-purpose)
CLI licenseBusiness Source License (BUSL)Mozilla Public License (open source)Apache License (open source)
State backendLocal, Terraform Cloud (managed), S3/GCS/Azure (self-hosted)Local, S3/GCS/Azure (self-hosted), client-side encryptionPulumi Cloud (managed), S3/GCS/Azure Blob/local (self-hosted)
Provider plugin ecosystemTerraform Registry; broad multi-cloud and SaaS coverageOpenTofu Registry; inherits same providers and modules (3,900+ providers per homepage)Pulumi Registry; broad multi-cloud and SaaS coverage
Primary differentiatorLargest existing HCL codebase; most enterprise adoptionOpen source governance; drop-in HCL compatibility; client-side state encryptionGeneral-purpose language support; unified app + infra codebase

The state backend column is where operational differences surface most concretely. Terraform Cloud and Pulumi Cloud both offer managed state with access controls, but they require a commercial relationship for full feature access. OpenTofu's client-side state encryption is the one area where it offers a capability that neither Terraform's open source tier nor the Pulumi CLI alone match. Teams with strict data residency or encryption requirements should weigh this when choosing between the two.

When to Choose Each Tool

Infrastructure as code tool selection comes down to four team-profile scenarios. Each maps to a different combination of language preference, open source requirement, and migration posture.

  1. Existing HCL investment, no open source mandate: choose Terraform. If your team has years of Terraform configuration, established modules, and no licensing conflict with BUSL, switching carries real migration cost with limited benefit. Terraform 1.x is stable, provider coverage is broad, and its managed cloud tier provides state management without additional tooling. Stay the course unless a specific BUSL restriction applies to your use case.
  2. HCL skills plus an open source requirement or BUSL concern: choose OpenTofu. The migration from Terraform to OpenTofu is the lowest-friction path in the IaC ecosystem because provider plugin blocks, HCL syntax, and the CLI workflow are identical at the point of the fork. Teams that need Mozilla Public License governance, want client-side state encryption without a commercial tier, or operate in environments with open source licensing policies will find OpenTofu the direct answer. Linux Foundation stewardship provides the governance continuity that BUSL introduced doubt about.
  3. Polyglot team that writes application code in a general-purpose language: choose Pulumi. When your engineers already work in Python, TypeScript, or Go, Pulumi removes the HCL context switch. Infrastructure logic can live in the same repository as application code, share the same test frameworks, and apply the same abstractions. Pulumi is particularly strong when infrastructure requirements involve complex conditionals, dynamic loops, or shared library patterns that express awkwardly in HCL.
  4. Migrating from Terraform to OpenTofu: treat it as a drop-in swap, not a rewrite. The OpenTofu project describes itself as a drop-in replacement. In practice, this means the state file format is compatible, provider blocks work without modification, and the init/plan/apply workflow is unchanged. The migration steps are narrow: update the binary, update required_version blocks to reference OpenTofu's version range, and verify provider plugin resolution against the OpenTofu Registry. The longer-term risk is feature divergence as both tools develop independently.

Migration and Adoption Considerations

Infrastructure as code migrations require careful sequencing to avoid state corruption or provider resolution failures. The following checklist applies to teams moving between any two of these tools, with particular relevance to Terraform-to-OpenTofu transitions. For teams adding Kubernetes workloads alongside their IaC tooling, the container security for Docker and Kubernetes guide covers the hardening considerations that apply once your IaC pipeline begins managing cluster resources.

  1. Verify state file compatibility. Terraform and OpenTofu share state file format at the point of the fork. Confirm your state backend is accessible and that the existing state file is uncorrupted before switching binaries.
  2. Audit provider plugin resolution. Confirm each provider plugin in your configuration resolves against the target registry. OpenTofu Registry and Terraform Registry carry the same providers, but source addresses may need updating if you reference private or mirrored registries.
  3. Update required_version constraints. HCL configuration blocks that pin a specific tool version need adjustment when migrating to OpenTofu. OpenTofu's required_version setting applies to the OpenTofu CLI version, which follows its own v1.x series independently of Terraform.
  4. Swap the binary in CI/CD pipelines. Replace the Terraform binary with the OpenTofu binary in each pipeline step. Verify that pipeline environment variables, wrapper scripts, and caching layers reference the correct binary path after the swap.

References

Frequently Asked Questions

Why was OpenTofu created?

OpenTofu is a community fork of Terraform launched after HashiCorp relicensed the Terraform CLI from the Mozilla Public License to the Business Source License (BUSL), restricting commercial use. The fork launched with backing from Harness, Gruntwork, Spacelift, env0, Scalr, and others, and is stewarded by the Linux Foundation. It preserves the same HCL syntax and provider ecosystem as Terraform while remaining fully open source.

Will OpenTofu stay compatible with future Terraform releases?

Compatibility is not guaranteed beyond the point of the fork. OpenTofu tracks its own v1.x compatibility promise, meaning HCL syntax and provider plugin interfaces stay stable within the OpenTofu 1.x series. However, as Terraform and OpenTofu diverge on new features, configurations written for one tool may not work identically on the other over time. Teams should treat them as parallel tracks rather than interchangeable binaries.

Where can I find providers and modules for OpenTofu?

OpenTofu uses the OpenTofu Registry, which inherits the same providers and modules previously available in the Terraform Registry. As of the OpenTofu homepage, the registry lists over 3,900 providers and 23,600 modules spanning every major cloud platform. Existing Terraform provider blocks work without modification in OpenTofu configurations.

When should a team choose Pulumi over Terraform or OpenTofu?

Pulumi is the strongest fit when your team already writes Python, TypeScript, Go, or another general-purpose language and wants infrastructure logic to live in the same codebase as application logic. It becomes particularly valuable when you need loops, conditionals, or abstractions that feel awkward to express in HCL. If your team prefers declarative config or needs drop-in compatibility with an existing Terraform state file, Terraform or OpenTofu is the lower-friction path.

Share this guide

Amara Okeke

Amara Okeke covers cloud and web hosting for techshooked for the people who run sites and small infrastructure, from managed hosting and domain pricing to outages and the trade-offs between platforms. Coverage follows the full bill, including egress, support tiers and migration effort, and treats an outage as a story about root cause, recovery time and what customers were told along the way.