STK-54Default Open source
Use OpenTofu for infrastructure as code
Describe all cloud resources in OpenTofu files kept in the repository, and apply them only from CI.
Review by
2027-04-30
How to do it
This pick is a recorded exception to the five-year test, dated 27 October 2026, because OpenTofu 1.6.0 shipped in January 2024. OpenTofu is the open source fork of Terraform, hosted by the Linux Foundation under the MPL-2.0 licence. Its first stable release was 1.6.0 on 10 January 2024. That is under five years, but it continues the Terraform code that reached 1.0 in June 2021. Version 1.13.1 shipped on 1 October 2026. Terraform is the most used tool of its kind in the Stack Overflow Developer Survey 2026, at 18.3%, ahead of Ansible at 12.0%. OpenTofu reads the same HCL files and providers, so AI tools write it well. Keep state remote as Keep state remote with locking and encryption says. Choose something else when a team already runs Terraform under a commercial HashiCorp contract. Then keep it and pin the version.
Examples
Terraform example
terraform {
required_version = "~> 1.13.0"
required_providers {
aws = { source = "hashicorp/aws", version = "~> 6.0" }
}
}
Shell example
tofu init -input=false
tofu plan -detailed-exitcode -out=plan.out
How to check
tofu plan on the main branch shows zero changes. The required_version line pins OpenTofu to one minor version, such as ~> 1.13.0.
Sources
Related rules
- INF-2 Keep state remote with locking and encryption in Infrastructure and environments
- STK-69 Use PagerDuty for paging and keep schedules as code in Software choices
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/stack/delivery-and-infrastructure/opentofu">Agent Wranglers software choices playbook</a>. In code you write, add a comment next to it with the same link.