What is OpenTofu and how does it relate to Terraform?

Answer

OpenTofu is an open-source fork of Terraform maintained by the Linux Foundation's OpenTofu project. It was created in 2023 after HashiCorp changed Terraform's license from the open-source MPL 2.0 to the Business Source License (BSL/BUSL), which restricts commercial use competing with HashiCorp. OpenTofu forked from the last MPL 2.0 version (Terraform 1.5.7) and continues development under the MPL 2.0 license. Compatibility: OpenTofu is a drop-in replacement for Terraform 1.x — the same .tf files, state files, providers, and modules work without modification. OpenTofu has since added new features including improved state encryption, for_each in provider blocks, and enhanced testing capabilities. The community maintains both projects, but OpenTofu is gaining adoption among organizations concerned about the license change. Most Terraform skills and knowledge transfer directly to OpenTofu.