Getting Started with OpenTofu: what Terraform users need to know

OpenTofu is the community-driven, open-source fork of Terraform that landed as a predictable option for teams worried about licensing and long‑term stewardship. If you’ve used Terraform before, the language (HCL), CLI shape, and provider model will look familiar — but a few governance, registry, and language details have diverged in useful ways. This short primer explains the practical differences you’ll actually feel when you read, write, or run your IaC. (opentofu.org)

Why the fork mattered (briefly)

When HashiCorp moved Terraform to a Business Source License (BSL), a community fork preserved the last MPL‑licensed code and placed it under neutral stewardship so the project would remain openly governed. That background explains why organizations evaluating long‑term risk often mention OpenTofu first: the project remains under a permissive open license and community governance. (linuxfoundation.org)

The registry story — same ecosystem, different address

One of the things people worry about most with a fork is whether the provider ecosystem will survive. OpenTofu runs its own public registry (search.opentofu.org / registry.opentofu.org) that mirrors many providers and modules from the Terraform world, so required_providers look and feel the same — only the resolution defaults to the OpenTofu registry unless you explicitly pin a different source. In short: your existing modules and providers are usually available, but the origin of truth (and mirrors) are different. (oneuptime.com)

Example (typical required_providers block):

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.30"
    }
  }
}

That same source string resolves against OpenTofu’s registry in the OpenTofu client, unless you specify a different registry host. (oneuptime.com)

Small but meaningful CLI/language differences

OpenTofu’s maintainers have added a handful of features that aren’t present in Terraform’s open binary. Notable examples include built‑in state encryption, provider iteration (ability to use for_each on provider blocks), earlier variable evaluation, and some CLI flags like -exclude. Those aren’t just toys — they change how you model certain patterns (multi‑region providers, secret handling, and large monorepos). (spacelift.io)

Provider for_each example (multi‑region pattern):

variable "aws_regions" {
  type = map(object({ vpc_cidr_block = string }))
}

provider "aws" {
  alias    = "by_region"
  for_each = var.aws_regions
  region   = each.key
}

resource "aws_vpc" "private" {
  for_each = { for region, cfg in var.aws_regions : region => cfg if cfg != null }
  provider = aws.by_region[each.key]
  cidr_block = each.value.vpc_cidr_block
}

This pattern reduces copy/paste for multi‑region setups, but it adds lifecycle considerations: provider instances must remain in the config long enough for OpenTofu to destroy resources tied to them. (opentofu.org)

State encryption and secrets handling

OpenTofu introduced optional state encryption so teams can control encrypted state without depending on external wrappers. The implementation uses a TF_ENCRYPTION-style configuration that can point to KMS or other key providers, so the state JSON is encrypted at rest and on disk by the client. That’s handy for teams that treat local disk or a shared object store as the sole state transport. (fossies.org)

Note the distinction: state encryption protects the state content, but it doesn’t change how you design secrets in code (sensitive variables, provider credentials, and secret rotation still require standard precautions).

Compatibility and gotchas

A pragmatic analogy

Think of Terraform as the vinyl record many teams learned to love — great sound but owned by a label that changed the rules. OpenTofu is a community pressing plant that keeps the same grooves but adds new features (like a dust‑filter and an adjustable tone arm) and guarantees anyone can make more pressings. The music is familiar, but the supply chain and production rules are different. That’s useful to remember when you standardize workflows or choose a platform for long‑lived infrastructure.

Final reading (where the docs live)

If you want to follow one source of truth, OpenTofu’s docs and registry pages are primary: the official docs cover provider configuration, provider instance iteration, and state encryption in depth; community writeups and vendor comparisons can help illuminate operational tradeoffs. (opentofu.org)

(End of article — technical references above point to the OpenTofu docs, registry guides, and independent comparisons that explain the governance, registry, and feature differences in practical terms.)