-
Notifications
You must be signed in to change notification settings - Fork 443
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
ADD OpenTofu support #411
ADD OpenTofu support #411
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest making this backwards compat to start and move to a breaking change in the future after opentofu support is stable
lib/tfenv-resolve-engine.sh
Outdated
elif [ "${#terraform_version_dir}" -lt "${#tofu_version_dir}" ]; then | ||
echo "tofu" | ||
else | ||
echo "terraform" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only doing a phone review but is this falling back to terraform if autodetect fails? If so, I'm in favor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JonZeolla Yep, exactly.
lib/tfenv-version-name.sh
Outdated
|
||
TFENV_VERSION_SOURCE='TFENV_TOFU_VERSION'; | ||
else | ||
log 'error' "Could not determine version. Engine set to ${TFENV_ENGINE}, make sure version files correspond to this or specify TFENV_ENGINE environment variable" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest making this a warning and fallback to terraform/backwards compatibility
elif [ "${TFENV_ENGINE}" = "tofu" ] && [ -n "${TFENV_TOFU_VERSION:-""}" ]; then | ||
version_source='TFENV_TOFU_VERSION'; | ||
else | ||
log 'error' "Could not determine version. Engine was determined to be ${TFENV_ENGINE}, ensure version files match that engine" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning instead of error?
libexec/tfenv-list-remote
Outdated
remote_versions="$(curlw -sSf "${TFENV_REMOTE}/terraform/")" \ | ||
|| log 'error' "Failed to download remote versions from ${TFENV_REMOTE}/terraform/"; | ||
|
||
#log 'debug' "Remote versions available: ${remote_versions}"; # Even in debug mode this is too verbose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove if unused?
Also I'm willing to test this just give me until next week if interested |
@JonZeolla Thanks for the feedback. I'll fix and push. If you have time to test it, much appreciated. |
c0cd6f2
to
0e2d80f
Compare
@orbitz I am slowly working through this in SeisoLLC/easy_infra#299 in my spare time; feedback welcome if you see that I am not following how you expected this to work. I will bring questions/issues here as I work through them |
LGTM |
@JonZeolla Do you know what's necessary to get this merged in? |
@orbitz no, sorry. I just know that I tested with both terraform and tofu and this branch seems to check out. For the time being, I am (unfortunately) just pinning my project to the opentofu fork and branch |
@Zordrak are you able to help get this merged? |
@jack-parsons-bjss ping! |
Rejected :: #409 (comment) |
Hello there, We'd appreciate your input and support on GitHub. Please feel free to submit issues and make contributions. Link to tofuenv: https://github.com/tofuutils/tofuenv tofuenv can be installed manually from GitHub or via brew (for mac users). |
Hi folks, tenv, is Golang based application, that means that you don't depend on shell or other environment dependencies anymore. We encourage you to make use of it, share any issues you encounter, and even contribute to its improvement. Your support and stars ⭐️ would be greatly appreciated! We're all ears for your feedback! We saved all tfenv features and added some new. It's an active, not dead development. We'll be glad to hear your wishes about new features and implement them in next releases. |
This adds support for OpenTofu. I have not added tests yet.
The major change is an environment variable called
TFENV_ENGINE
which can be explicitly specified or is automatically determined based on heuristic of version file names.