-
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 2 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
48 changes: 48 additions & 0 deletions
48
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,48 @@ | ||
# Support Smooth OpenTofu Adoption | ||
|
||
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 is too critical to run on anything but proven open source technology. In line with this philosophy, Gruntwork IaC Library aims to provide first-class OpenTofu support. | ||
|
||
But in the real world, platform engineers face endless module and tooling upgrades, [yak shaves](https://softwareengineering.stackexchange.com/a/388236) and competing priorities. This means we must balance our desire to embrace the latest OpenTofu functionality with our separate principle of [being judicious with new features](be-judicious-with-new-features.md). | ||
|
||
## Core principle | ||
|
||
Given our need to balance embracing the latest OpenTofu functionality while keeping real-world maintenance as easy as possible, we must make it easy for customers to transition from Terraform to OpenTofu without requiring them to learn new syntax or extensively modify their existing configurations. | ||
|
||
## Implementation | ||
|
||
### High-level approach | ||
|
||
1. We support modern OpenTofu versions in our modules. | ||
1. However, we strongly prefer language features that work identically in both OpenTofu and Terraform. | ||
1. We avoid OpenTofu-specific syntax unless there is a compelling reason and clear customer benefit. | ||
|
||
### 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 language features we use, but do not explicitly test or support Terraform versions beyond 1.5.7 | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
When we upgrade a module to require a newer version of OpenTofu, we explicitly require that version in the `terraform` block of the module, publish a major module version release in the related git repo, and include clear migration guidance, if applicable. | ||
|
||
### 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-specific 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. | ||
josh-padnick marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
3. **Terraform-specific Features**: We do not support Terraform-specific features. | ||
josh-padnick marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
## 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 Terraform and OpenTofu 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 | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
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.