Skip to content

Conversation

@westonplatter
Copy link
Member

@westonplatter westonplatter commented Nov 7, 2025

what

  • enanble users to easily switch between Terraform and Tofu

why

references

Summary by CodeRabbit

Release Notes

  • Chores

    • Updated dependencies to latest versions, including go-task, dasel, jq, and GitHub CLI
    • Updated registry reference to v4.433.0
  • New Features

    • Added support for using OpenTofu as an alternative to Terraform through configuration

@westonplatter westonplatter requested a review from a team as a code owner November 7, 2025 00:15
@westonplatter westonplatter requested a review from Gowiem November 7, 2025 00:15
@westonplatter westonplatter changed the title Feat/tf to use terraform opentofu feat(tf): default to tofu and allow switching back to terraform Nov 7, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 7, 2025

Walkthrough

The pull request reorganizes the terraform task infrastructure by renaming the includes.terraform key to includes.tf and updating the path from lib/terraform to lib/tf. Within the new taskfile structure, a conditional TF_CMD environment variable is introduced that dynamically selects between "terraform" and "tofu" based on a USE_TERRAFORM flag, with all terraform operations (init, plan, apply, refresh) updated to use this variable. Additionally, aqua.yaml is updated with version bumps for the registry and several packages.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • lib/tf/Taskfile.yml: Verify the TF_CMD conditional logic works correctly in practice and that the shell substitution properly handles both terraform and tofu invocations
  • Taskfile.yaml: Confirm the path migration from lib/terraform to lib/tf doesn't break existing task references or includes
  • aqua.yaml: Cross-check that the package version bumps are intentional and compatible with the codebase (particularly go-task/task v3.45.4 compatibility)

Possibly related PRs

Suggested reviewers

  • oycyc
  • Gowiem
  • gberenice

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: introducing OpenTofu (tofu) as the default while preserving the ability to switch to Terraform, which aligns with the key modifications across all three files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/tf-to-use-terraform-opentofu

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
lib/tf/Taskfile.yml (1)

31-36: Update task descriptions to reflect support for both Terraform and OpenTofu.

The task descriptions and examples still reference "Terraform" exclusively, but these tasks now work with either Terraform or OpenTofu. Update the descriptions, summaries, and usage examples to clarify that the actual tool is determined by the USE_TERRAFORM environment variable.

For example:

- desc: Initialize Terraform working directory with a backend configuration file.
+ desc: Initialize Terraform or OpenTofu working directory with a backend configuration file.
  summary: |
-   Initializes Terraform directory using the backend config file for the specified environment.
+   Initializes Terraform/OpenTofu directory using the backend config file for the specified environment.
-   The `terraform init` arguments can be optionally passed in.
+   The `terraform init` (or `tofu init`) arguments can be optionally passed in.
-   Usage: task terraform:init -- ENVIRONMENT [terraform init arguments]
+   Usage: task terraform:init -- ENVIRONMENT [init arguments]

Also applies to: 47-53, 64-70, 81-87

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ac8f80c and b971ea5.

📒 Files selected for processing (3)
  • Taskfile.yaml (1 hunks)
  • aqua.yaml (1 hunks)
  • lib/tf/Taskfile.yml (5 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.yaml

⚙️ CodeRabbit configuration file

**/*.yaml: You are well-versed in writing and reviewing YAML configurations for the Task tool (https://taskfile.dev/).
Provide recommendations for clarity, maintainability, and adherence to Taskfile best practices, including usage of variables, environment blocks, and includes.
These configurations may also contain embedded Bash scripts or commands.
Demonstrate bash scripting best practices such as error handling, secure variable expansions, and clear documentation.

Files:

  • Taskfile.yaml
  • aqua.yaml
🔇 Additional comments (3)
aqua.yaml (1)

4-4: Verify package version compatibility and check for breaking changes in aqua registry v4.433.0 update.

The registry and package versions have been substantially bumped. Before merging, confirm that these updated versions (particularly the large registry jump from v4.78.0 to v4.433.0) are compatible with the current taskit setup and don't introduce breaking changes.

Also applies to: 6-10

Taskfile.yaml (1)

11-12: LGTM! Clean includes reorganization.

The rename from lib/terraform to lib/tf is cleaner and the removal of the redundant aliases: [tf] is appropriate now that the key name itself is tf. Migration is complete with no lingering references to the old path—the new lib/tf/Taskfile.yml is properly in place and ready to go.

lib/tf/Taskfile.yml (1)

27-28: Confirm default behavior change and ensure migration documentation.

The git history confirms this is a breaking change: the previous implementation hardcoded terraform for all tasks, while the new default switches to tofu unless USE_TERRAFORM=true is explicitly set. This will affect existing workflows that rely on the Terraform default.

Ensure this change is documented in:

  • Release notes or changelog
  • README or project documentation
  • Any deployment/migration guides

The shell syntax is functionally correct, though making the default explicit would improve clarity:

-      TF_CMD:
-        sh: '[ "${USE_TERRAFORM}" = "true" ] && echo "terraform" || echo "tofu"'
+      TF_CMD:
+        sh: '[ "${USE_TERRAFORM:-false}" = "true" ] && echo "terraform" || echo "tofu"'

This makes USE_TERRAFORM defaulting to false explicit, which can help future maintainers understand the intended behavior.

@westonplatter westonplatter mentioned this pull request Nov 7, 2025
1 task
Copy link
Member

@Gowiem Gowiem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome stuff :shipit:

@westonplatter westonplatter merged commit 71d42fe into main Nov 7, 2025
3 checks passed
@westonplatter westonplatter deleted the feat/tf-to-use-terraform-opentofu branch November 7, 2025 18:13
westonplatter added a commit that referenced this pull request Nov 11, 2025
…40)

## what

- We're modernized our TF backend strategy to use a single dynamic
backend file.
- Therefore, we can remove the backend file switching and simplify the
`tf:init` command
- Additionally, revised the task `desc` and `summary` attributes to
highlight ability to use either Terraform or OpenTofu as a follow up to
#38

## why

## references

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
* Added support for OpenTofu as an alternative tool to Terraform for
infrastructure management, selectable via configuration.

* **Improvements**
* Simplified backend configuration handling by removing fixed
backend-file requirements.
* Introduced new public configuration variable for specifying custom
Terraform variables path location.
* Updated task naming conventions and descriptions to reflect dual tool
support.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
westonplatter pushed a commit that referenced this pull request Nov 11, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.5.0](v0.4.0...v0.5.0)
(2025-11-11)


### Features

* add linter configs to the os sync task
([#26](#26))
([6142651](6142651))
* add terraform refresh command
([#33](#33))
([2bb2893](2bb2893))
* add workspace selection
([#35](#35))
([ac8f80c](ac8f80c))
* **pruning:** remove cursor specific task commands.
([#37](#37))
([8c908c2](8c908c2))
* **tf:** default to tofu and allow switching back to terraform
([#38](#38))
([71d42fe](71d42fe))
* **tf:** update the tf:init command to work for TF dynamic backends
([#40](#40))
([0706965](0706965))


### Bug Fixes

* **aqua:** update installer version to pull in checksum fix
([#34](#34))
([b47b0ef](b47b0ef))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants