OpenTofu
OpenTofu is an open-source, Terraform-compatible engine that aims to provide a community-backed and backwards compatible alternative to the official Terraform binary. Terrateam supports using OpenTofu as the underlying engine for your Terraform operations, allowing you to take advantage of its additional features.
Configuring OpenTofu
To use OpenTofu with Terrateam, you need to configure the engine
section in your Terrateam configuration file (.terrateam/config.yml
).
In this example, we set the name
to tofu
to indicate that we want to use OpenTofu as the engine, and we specify the desired version of OpenTofu with the version
key.
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.
-
Open a pull request with changes to your Terraform code.
-
Terrateam automatically runs a plan operation using OpenTofu and comments on the pull request with the plan output.
-
Review the plan output and collaborate with your team to ensure the changes are as expected.
-
Once the pull request is approved, comment
terrateam apply
to trigger an apply operation using OpenTofu. -
Terrateam runs the apply operation and comments on the pull request with the apply output.
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 toterraform
and specify the desired version.
Example
Here’s an example of a Terrateam configuration file that uses OpenTofu and sets up a custom workflow:
In this example, we use OpenTofu version 1.6.2 as the engine and define a custom workflow for the prod
environment. The plan step includes the -parallelism
flag to specify the number of concurrent operations. After the apply, a custom script is run to notify Slack of the changes.