← All insightsBest Practices

OpenTofu best practices for teams

Nir Geier, CodeWizard · 9 December 2025 · 3 min read · Intermediate

OpenTofu rewards a little discipline. These are the practices that keep it maintainable as a team and a codebase grow.

The practices

  • Standardize on one binary per project
  • Use native state encryption for sensitive state
  • Pin provider versions and commit the lock file

What good looks like

Identical HCL to Terraform - just run with tofu.

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 }
  }
}

Anti-patterns to retire

  • Mixing tofu and terraform state operations in one project
  • Assuming 100% provider parity for the newest Terraform-only features
  • Local state - use remote, locked backends

Want senior help putting OpenTofu to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.

Like where this is going?

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

Book a free consult