You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have now tried the min-required feature that recently shipped with #335 (after testing the one in #305).
It does not seem to work for the use case I described at #305 (comment) and my mixed-version code base.
if I use TFENV_TERRAFORM_VERSION=min-required, then that first terraform --version call fails with [1]
if I don’t set it, then tfenv does not attempt to read the the min-required and use the 'default' 0.12, which fails with tf13 code. [2]
#305 ended up implementing a graceful fallback on the next detection method. Would something similar be possible here?
(As said in that comment, perhaps my use-case is somewhat specific ; and I can see how automatic fallbacks can be confusing).
[1] Logs
[DEBUG] DEBUG trap set
[DEBUG] Helpers sourced successfully
[DEBUG] $PATH does not contain '/tfenv/libexec', prepending and exporting it now
[DEBUG] $PATH already contains '/tfenv/bin', not adding it again
[DEBUG] program="terraform"
[DEBUG] Getting version from tfenv-version-name
[DEBUG] TFENV_VERSION specified in TFENV_TERRAFORM_VERSION environment variable: min-required
[DEBUG] TFENV_VERSION uses min-required keyword, looking for a required_version in the code
[DEBUG] Appropriate required_version not found, skipping min-required
[ERROR] Specifically asked for min-required via terraform{required_version}, but none found
[2] Logs
[DEBUG] DEBUG trap set
[DEBUG] Helpers sourced successfully
[DEBUG] $PATH does not contain '/tfenv/libexec', prepending and exporting it now
[DEBUG] $PATH already contains '/tfenv/bin', not adding it again
[DEBUG] program="terraform"
[DEBUG] Getting version from tfenv-version-name
[DEBUG] We are not hardcoded by a TFENV_TERRAFORM_VERSION environment variable
[DEBUG] Looking for a version file in my-terraform-repo/environments/prod/app/
[DEBUG] Not found at my-terraform-repo/environments/prod/app/.terraform-version
[DEBUG] Not found at my-terraform-repo/environments/core-us/test/.terraform-version
[DEBUG] Not found at my-terraform-repo/environments/core-us/.terraform-version
[DEBUG] Not found at my-terraform-repo/environments/.terraform-version
[DEBUG] Found at my-terraform-repo/.terraform-version
[DEBUG] TFENV_VERSION_FILE retrieved from tfenv-version-file: my-terraform-repo/.terraform-version
[DEBUG] TFENV_VERSION specified in TFENV_VERSION_FILE: 0.12.31
[DEBUG] TFENV_VERSION does not use "latest" keyword
[DEBUG] TFENV_VERSION is 0.12.31
[DEBUG] TF_BIN_PATH added to PATH: /tfenv/versions/0.12.31/terraform
[DEBUG] Executing: /tfenv/versions/0.12.31/terraform --version
[DEBUG] DEBUG trap set
[DEBUG] Helpers sourced successfully
[DEBUG] $PATH does not contain '/tfenv/libexec', prepending and exporting it now
[DEBUG] $PATH already contains '/tfenv/bin', not adding it again
[DEBUG] program="terraform"
[DEBUG] Getting version from tfenv-version-name
[DEBUG] We are not hardcoded by a TFENV_TERRAFORM_VERSION environment variable
[DEBUG] Looking for a version file in my-terraform-repo/environments/prod/app/.terragrunt-cache/8kcUskwcodabi_9rgmHym1b0bKE/FHuSDBinFToTe6gwQR0jDZ9T7p4/app
[DEBUG] Not found at my-terraform-repo/environments/prod/app/.terragrunt-cache/8kcUskwcodabi_9rgmHym1b0bKE/FHuSDBinFToTe6gwQR0jDZ9T7p4/app/.terraform-version
[DEBUG] Not found at my-terraform-repo/environments/prod/app/.terragrunt-cache/8kcUskwcodabi_9rgmHym1b0bKE/FHuSDBinFToTe6gwQR0jDZ9T7p4/.terraform-version
[DEBUG] Not found at my-terraform-repo/environments/prod/app/.terragrunt-cache/8kcUskwcodabi_9rgmHym1b0bKE/.terraform-version
[DEBUG] Not found at my-terraform-repo/environments/prod/app/.terragrunt-cache/.terraform-version
[DEBUG] Not found at my-terraform-repo/environments/prod/app/.terraform-version
[DEBUG] Not found at my-terraform-repo/environments/prod/.terraform-version
[DEBUG] Not found at my-terraform-repo/environments/.terraform-version
[DEBUG] Found at my-terraform-repo/.terraform-version
[DEBUG] TFENV_VERSION_FILE retrieved from tfenv-version-file: my-terraform-repo/.terraform-version
[DEBUG] TFENV_VERSION specified in TFENV_VERSION_FILE: 0.12.31
[DEBUG] TFENV_VERSION does not use "latest" keyword
[DEBUG] TFENV_VERSION is 0.12.31
[DEBUG] TF_BIN_PATH added to PATH: /tfenv/versions/0.12.31/terraform
[DEBUG] Executing: /tfenv/versions/0.12.31/terraform init
The text was updated successfully, but these errors were encountered:
$ export TFENV_TERRAFORM_VERSION=min-required
$ ls
# empty dir
$ tfenv use 1.0.2
Failure to resolve version from 1.0.2
$ cd myapp
# terraform min required : 1.0.3
$ tfenv use 1.0.2
Switching default version to v1.0.3
Default version (when not overridden by .terraform-version or TFENV_TERRAFORM_VERSION) is now: 1.0.3
I was thinking that TFENV_TERRAFORM_VERSION would be used ONLY when I don't specify a version in command line.
JeanFred
added a commit
to JeanFred/tfenv
that referenced
this issue
Oct 25, 2022
Even when setting `TFENV_TERRAFORM_VERSION` to `min-required`,
we might prefer to fallback on the normal inference method
rather than a hard fail.
Resolvestfutils#353
I have now tried the
min-required
feature that recently shipped with #335 (after testing the one in #305).It does not seem to work for the use case I described at #305 (comment) and my mixed-version code base.
TFENV_TERRAFORM_VERSION=min-required
, then that firstterraform --version
call fails with [1]#305 ended up implementing a graceful fallback on the next detection method. Would something similar be possible here?
(As said in that comment, perhaps my use-case is somewhat specific ; and I can see how automatic fallbacks can be confusing).
[1] Logs
[2] Logs
The text was updated successfully, but these errors were encountered: