AWS CDK vs Terraform: Which IaC Tool Should You Use in 2026?
AWS CDK vs Terraform compared for 2026. Programming languages vs HCL, L2 constructs vs modules, state management, multi-cloud
DevOps
Terraform vs OpenTofu compared for 2026. Licensing (BSL vs MPL), feature differences (Stacks, ephemeral resources), provider compatibility
| Criterion | Terraform | OpenTofu |
|---|---|---|
| License | BSL 1.1 | MPL 2.0 (Linux Foundation) |
| Governance | HashiCorp / IBM | Linux Foundation |
| Provider compatibility | HashiCorp Registry | Drop-in compatible (TF 1.5 era) |
| State | State encryption via HCP | Native state encryption |
| Best for | Teams comfortable with BSL | Teams needing OSI-approved license |
In August 2023, HashiCorp changed Terraform's license from open-source MPL 2.0 to the Business Source License (BSL 1.1). The community forked Terraform as OpenTofu under the Linux Foundation. In 2026 — with IBM's acquisition of HashiCorp complete and OpenTofu at version 1.9 — the two projects have diverged enough that the choice matters.
Here's an honest comparison.
| Feature | Terraform (HashiCorp/IBM) | OpenTofu (Linux Foundation) |
|---|---|---|
| License | BSL 1.1 (not open source) | MPL 2.0 (open source) |
| Latest version (2026) | 1.10.x | 1.9.x |
| Terraform Stacks | ✅ Yes (GA late 2025) | ❌ No |
| Ephemeral resources | ✅ Yes | ✅ Yes (independent impl.) |
| State encryption | ❌ No (use backend encryption) | ✅ Native client-side |
| Provider ecosystem | Full registry | Full compatibility |
| Module registry | registry.terraform.io | registry.opentofu.org + TF registry |
| HCP Terraform (Cloud) | ✅ Full integration | ❌ Not available |
| Sentinel policies | ✅ HCP only | ❌ Use OPA instead |
| Commercial support | HashiCorp/IBM | Community + vendors |
| CLI command | terraform | tofu |
| State file format | Compatible | Compatible |
You CAN:
✅ Use Terraform for your own infrastructure
✅ Use it in your CI/CD pipelines
✅ Build internal tools on top of it
✅ Contribute to the codebase
You CANNOT:
❌ Build a competing hosted Terraform service
❌ Embed Terraform in a commercial product that competes with HCPThe BSL converts to open-source Apache 2.0 after 4 years. Code from August 2023 becomes Apache 2.0 in August 2027.
You CAN:
✅ Everything — it's fully open source
✅ Build competing products
✅ Fork, modify, redistribute
✅ Use commercially without restrictionTerraform Stacks (GA late 2025)
Stacks let you deploy multiple Terraform configurations as a single unit with coordinated lifecycle management:
# stack.tfstack.hcl
component "networking" {
source = "./modules/networking"
inputs = {
region = var.region
}
}
component "compute" {
source = "./modules/compute"
inputs = {
vpc_id = component.networking.vpc_id
subnet_ids = component.networking.subnet_ids
}
}This is the biggest feature gap between Terraform and OpenTofu in 2026.
HCP Terraform Integration
Remote state, remote runs, Sentinel policies, cost estimation, private registry — all exclusive to HashiCorp's cloud platform.
Client-Side State Encryption
OpenTofu can encrypt state files before they're stored in any backend:
# OpenTofu-only feature
terraform {
encryption {
method "aes_gcm" "default" {
keys = key_provider.pbkdf2.default
}
state {
method = method.aes_gcm.default
enforced = true
}
}
}With Terraform, you rely on backend-level encryption (S3 SSE, GCS encryption). OpenTofu adds a client-side layer — the state is encrypted before it leaves your machine.
Early Access to Some Features
OpenTofu sometimes ships features faster since it doesn't gate behind HCP:
for_each in provider blocks (shipped earlier in OpenTofu)import blocks for codeless importmoved blocks for refactoringcheck blocks for assertionsBoth use the same provider protocol. In practice:
# This works identically in both
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}Module compatibility is also near-100%. The main exceptions are modules that use Terraform Stacks or HCP-specific features.
State files are compatible. You can switch between terraform and tofu on the same state:
# Switch from Terraform to OpenTofu
tofu init
tofu plan # Reads existing Terraform state
tofu apply # Updates state (now managed by OpenTofu)
# Switch back to Terraform
terraform init
terraform plan # Reads OpenTofu-written stateCaveat: If you use OpenTofu-only features (state encryption, for_each on providers), the state may not be readable by Terraform.
# 1. Install OpenTofu
brew install opentofu
# or
curl -fsSL https://get.opentofu.org/install-opentofu.sh | sh
# 2. In your project directory
tofu init # Downloads providers (uses same registry)
tofu plan # Should show no changes
tofu apply # Now managed by OpenTofu
# 3. Update CI/CD
# Replace 'terraform' with 'tofu' in your pipeline# Before
image: hashicorp/terraform:1.10
# After
image: ghcr.io/opentofu/opentofu:1.9
script:
- tofu init
- tofu plan
- tofu apply -auto-approveFor most teams managing AWS/Azure/GCP infrastructure:
The choice comes down to licensing philosophy, Stacks, and whether you pay for HCP Terraform.
In 2026, Terraform and OpenTofu are both mature, production-ready IaC tools with near-identical daily workflows. Terraform leads with Stacks and HCP integration; OpenTofu leads with open-source licensing and state encryption. Most teams can use either — the decision is about licensing philosophy and whether you need HCP Terraform's managed features. If you're already on Terraform and happy, there's no urgent reason to switch. If licensing matters or you need state encryption, OpenTofu is the clear choice.
AWS CDK vs Terraform compared for 2026. Programming languages vs HCL, L2 constructs vs modules, state management, multi-cloud
Pulumi vs Terraform compared for 2026. Programming languages vs HCL, state management, testing, provider support, pricing
Terraform Stacks vs Workspaces compared. Understand when to use Workspaces for environment isolation vs Stacks for multi-component orchestration
CloudFormation vs Terraform compared for AWS in 2026. State management, multi-cloud support, drift detection, modules vs nested stacks, and when to use each.