Terraform interview question · Most asked
Terraform or OpenTofu: what is the difference, and how would you choose?
Summary
In August 2023 HashiCorp relicensed Terraform from MPL 2.0 to the Business Source License, which restricts offering competing services. OpenTofu forked the last MPL version and is developed under the Linux Foundation; it is largely compatible with Terraform configuration and providers and has added its own features, such as client-side state encryption.
Longer Answer
For most companies using Terraform internally, the BSL does not restrict use; the choice is about licence preference, vendor relationship (HCP Terraform features), and feature roadmap divergence over time. Tooling such as Atlantis, Terragrunt and many CI platforms supports both. Migration is usually straightforward but should be tested, and the two are drifting apart with new features, so avoid mixing them on the same state.
Key Points
- BSL relicence in 2023; OpenTofu fork under LF.
- Largely compatible; diverging features.
- Choice: licence, vendor, features.
- Do not mix on one state.
More most-asked Terraform questions
- How do you handle secrets in Terraform?
- How would you run Terraform in CI/CD?
- What is Terraform state, why is it needed, and where should it be stored?
- count or for_each: when do you use each?
- Walk through terraform init, plan and apply. What does each do?
- What is Terraform, and how does it work at a high level?
- What are Terraform modules, and how do you design good ones?
- A terraform plan wants to destroy and recreate a database. What do you do?