← All insightsComparison

Terraform vs OpenTofu: which should you choose?

Nir Geier, CodeWizard · 18 June 2025 · 3 min read · Intermediate

Terraform and OpenTofu solve overlapping problems, and teams often have to pick one. Here is an honest comparison of what each does well and how to choose.

Terraform

Terraform describes infrastructure as declarative HCL, builds a dependency graph, and shows a plan of exactly what will change before it applies - across AWS, Azure, GCP and hundreds of providers.

hcl
terraform {
  required_providers { aws = { source = "hashicorp/aws", version = "~> 5.0" } }
  backend "s3" {
    bucket = "acme-tfstate"
    key    = "prod/network.tfstate"
    region = "eu-west-1"
  }
}

variable "env" { type = string, default = "prod" }

resource "aws_s3_bucket" "assets" {
  bucket = "acme-${var.env}-assets"
  tags   = { Environment = var.env }
}

OpenTofu

OpenTofu is a drop-in, MPL-2.0 licensed fork of Terraform under the Linux Foundation. It speaks the same HCL and provider ecosystem, with community governance and features like state encryption.

hcl
terraform {
  required_providers { aws = { source = "hashicorp/aws" } }
  encryption {          # OpenTofu native state encryption
    key_provider "pbkdf2" "k" { passphrase = var.state_pass }
    method "aes_gcm" "m" { keys = key_provider.pbkdf2.k }
    state { method = method.aes_gcm.m }
  }
}

How to choose

  • Choose Terraform if: every infrastructure change is reviewed as code in a pull request
  • Choose OpenTofu if: open governance and a permissive license
  • Prefer the option your team can operate and debug confidently
  • Match the tool to your scale today, with a clear path for tomorrow
The best tool is the one your team will actually operate well - not the one with the longest feature list.

Not sure which fits your stack? CodeWizard's senior engineers use both Terraform and OpenTofu in production and can give you a straight answer for your context.

Like where this is going?

Get hands-on help from the engineers who write these posts.

Book a free consult