Skip to content

OpenTofu

OpenTofu is an open-source, Terraform-compatible engine designed to offer a community-supported, backward-compatible alternative to the official Terraform binary. Terrateam supports the use of OpenTofu, enabling you to leverage its additional features.

Configuring OpenTofu

Global

To integrate OpenTofu into all Terrateam operations, simply configure the engine section within your Terrateam configuration file (.terrateam/config.yml).

engine:
name: tofu
version: 1.6.2

Specific Workflow

To integrate OpenTofu for a specific workflow, configure the workflows.engine section.

workflows:
- tag_query: prod
engine:
name: tofu
version: 1.6.2

OpenTofu Features

OpenTofu provides several benefits over the official Terraform binary, including:

  • 100% open source
  • Mozilla Public License, providing the freedom to use, modify, and distribute
  • Strong community support
  • Feature development directed by the community

Using OpenTofu with Terrateam

Once you’ve configured OpenTofu in your Terrateam configuration file, you can use Terrateam commands as usual. Terrateam will automatically use OpenTofu as the underlying engine for your Terraform operations.

  1. Open a pull request with changes to your Terraform code.

  2. Terrateam automatically runs a plan operation using OpenTofu and comments on the pull request with the plan output.

  3. Review the plan output and collaborate with your team to ensure the changes are as expected.

  4. Once the pull request is approved, comment terrateam apply to trigger an apply operation using OpenTofu.

  5. Terrateam runs the apply operation and comments on the pull request with the apply output.

Migrating from Terraform to OpenTofu

Currently, OpenTofu is a drop-in replacement for Terraform, ensuring compatibility with versions 1.5.x and most of 1.6.x. No modifications to your existing code are necessary for continued compatibility. OpenTofu is well-suited for production environments across various use cases without exceptions. For detailed migration instructions, refer to the official migration guide.

Considerations

  • OpenTofu’s version numbering does not necessarily match that of Terraform. Make sure to use a version of OpenTofu that is compatible with your Terraform code and provider versions.
  • If you need to switch back to the official Terraform binary, simply update your Terrateam configuration file to set the engine name to terraform and specify the desired version.