-
Notifications
You must be signed in to change notification settings - Fork 43
Add a Library principle for supporting smooth OpenTofu adoption. #2729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ec1c8df
Add a Library principle for supporting smooth OpenTofu adoption.
josh-padnick 62336c1
Apply coderabbit changes.
josh-padnick 70522cb
Tighten up the ideas and language.
josh-padnick 0fe31ee
Fix typo
josh-padnick 1820413
Apply suggestion from @yhakbar
josh-padnick b9d850d
Apply suggestion from @yhakbar
josh-padnick d471e2b
Apply suggestion from @yhakbar
josh-padnick 038568c
Apply suggestion from @yhakbar
josh-padnick aa47a3b
Apply suggestion from @yhakbar
josh-padnick 967e5ff
Merge branch 'main' into opentofu-migration
josh-padnick File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
docs/2.0/docs/library/concepts/principles/opentofu-adoption.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # Prefer OpenTofu; Minimize Friction | ||
|
|
||
| Gruntwork is a co-founder and active maintainer of [OpenTofu](https://opentofu.org/), the open source successor to HashiCorp Terraform. We proudly support OpenTofu because we believe that core infrastructure should run on proven open source technology. In line with this philosophy, Gruntwork IaC Library aims to provide first-class OpenTofu support. | ||
|
|
||
| But we also know that platform teams may be on very early versions of Terraform (pre-1.0) or still on Terraform 1.5.7, and that upgrading to the latest OpenTofu is yet another item on their plate of competing priorities. This means we must balance the benefits of embracing the latest OpenTofu functionality with the real-world costs of migration. | ||
|
|
||
| ## Core principle | ||
|
|
||
| We prefer OpenTofu over Terraform but design our modules to work seamlessly with both whenever possible, ensuring customers can adopt OpenTofu without syntax changes or configuration rewrites. | ||
|
|
||
| ## Implementation | ||
|
|
||
| ### Approach | ||
|
|
||
| 1. We design our modules to work with both OpenTofu and Terraform, prioritizing features that work identically in both tools. | ||
| 2. When we do adopt OpenTofu-specific features, we use `.tofu` files and provide clear migration guidance. | ||
|
|
||
| ### OpenTofu/Terraform version support | ||
|
|
||
| - **OpenTofu**: We support OpenTofu 1.9 for new features that provide significant customer value. | ||
| - **Terraform**: We maintain compatibility with Terraform versions that support the same OpenTofu language features we use, but do not explicitly test or support Terraform versions beyond 1.5.7. | ||
josh-padnick marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ### OpenTofu feature adoption | ||
|
|
||
| When evaluating new OpenTofu language features for use in Gruntwork modules: | ||
|
|
||
| 1. **Dual-compatible features (Preferred)**: Features that work identically in both OpenTofu and Terraform should be placed in `.tf` files. (e.g. see [cross-variable validation](#cross-variable-validation) below.) | ||
| 2. **OpenTofu-only Features (Discouraged)**: Features that only work in OpenTofu should be placed in `.tofu` files and used sparingly. Terraform ignores `.tofu` files, while OpenTofu reads both `.tf` and `.tofu`. Avoid duplicating the same blocks across both extensions; prefer additive enhancements in `.tofu`. This approach increases maintenance cost, so we will use it only when the user benefit is clear. | ||
| 3. **Terraform-only Features**: We do not support Terraform-specific features. | ||
|
|
||
| ## Current feature adoption | ||
josh-padnick marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ### Cross-variable validation | ||
|
|
||
| We now support cross-variable validation (the ability to reference the values of other variables in `variable` validation blocks) because: | ||
| - It significantly improves module usability by preventing invalid input combinations | ||
| - It works identically in both OpenTofu 1.9+ and Terraform 1.9+ | ||
| - It addresses direct customer feedback about configuration errors | ||
|
|
||
| ## Future evolution | ||
|
|
||
| This principle will evolve as the OpenTofu and Terraform ecosystems develop. We will: | ||
| - Regularly review compatibility and our support policy based on customer needs | ||
| - Update our supported feature list as new stable releases become available | ||
| - Clearly communicate any changes to our compatibility strategy | ||
| - Regularly review any customer request for adoption of new features | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.