Skip to content

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).

engine:
name: tofu
version: 1.6.2

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.

  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.

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.

Example

Here’s an example of a Terrateam configuration file that uses OpenTofu and sets up a custom workflow:

engine:
name: tofu
version: 1.6.2
workflows:
- tag_query: prod
plan:
- type: init
- type: plan
extra_args: ["-parallelism=10"]
apply:
- type: init
- type: apply
- type: run
cmd: ["./scripts/notify_slack.sh"]

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.

We use cookies and similar technologies to provide certain features, enhance the user experience and deliver content that is relevant to your interests. Depending on their purpose, analysis and marketing cookies may be used in addition to technically necessary cookies. By clicking on "Agree and continue", you declare your consent to the use of the aforementioned cookies. Here you can make detailed settings or revoke your consent (in part if necessary) with effect for the future. For further information, please refer to our Privacy Policy .