Skip to content
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

tenv tf use uninformative error if no terraform version installed #172

Closed
Nmishin opened this issue Jun 15, 2024 · 7 comments · Fixed by #180
Closed

tenv tf use uninformative error if no terraform version installed #172

Nmishin opened this issue Jun 15, 2024 · 7 comments · Fixed by #180
Assignees
Labels
bug Something isn't working

Comments

@Nmishin
Copy link
Collaborator

Nmishin commented Jun 15, 2024

Describe the bug
If I run tenv tf use 1.2.0 I expect that terraform version will be switched to the needed version, or i will have an error like "version should be installed"

To Reproduce
For now I have no error, or additional log message

$ tenv tf use 1.2.0
Written 1.2.0 in /Users/nmishin/.tenv/Terraform/version
$ terraform version
Failure during terraform call : fork/exec /Users/nmishin/.tenv/Terraform/1.2.0/terraform: no such file or directory

Expected behavior
I want to have some error log

Environment (please complete the following information):
$ tenv --version
tenv version 2.0.7

@kvendingoldo kvendingoldo added the bug Something isn't working label Jun 15, 2024
@dvaumoron
Copy link
Contributor

Will be fixed by #165

@Nmishin
Copy link
Collaborator Author

Nmishin commented Jun 16, 2024

fixed by #165

@Nmishin Nmishin closed this as completed Jun 16, 2024
@kvendingoldo kvendingoldo reopened this Jun 17, 2024
@kvendingoldo
Copy link
Collaborator

Still an issue:

➜  ~ tenv tf list
  1.1.0-rc1
  1.1.9
  1.5.7
  1.7.4
  1.8.0
  1.8.1
  1.8.2
  1.8.3
  1.8.4
  1.8.5
  1.10.0-alpha20240606
➜  ~ tenv tf use 1.6.0
Written 1.6.0 in /Users/asharov/.tenv/Terraform/version
➜  ~ terraform version
Failure during terraform call : fork/exec /Users/asharov/.tenv/Terraform/1.6.0/terraform: no such file or directory

@dvaumoron
Copy link
Contributor

Seem to work as expected

$ tenv tf use latest
No compatible version found locally, search a remote one...
Fetching all releases information from https://releases.hashicorp.com/terraform/index.json
Found compatible version remotely : 1.8.5
Auto-install is disabled. To install 1.8.5 version you can set environment variable TENV_AUTO_INSTALL=true, or install it via any of the following command: 'tenv terraform install', 'tenv terraform install 1.8.5'
Error: no compatible version found locally
Usage:
  tenv tf use version [flags]

Flags:
  -a, --arch string          specify arch for binaries downloading (default "amd64")
  -f, --force-remote         force search on versions available at TFENV_REMOTE url
  -h, --help                 help for use
  -k, --key-file string      local path to PGP public key file (replace check against remote one)
  -n, --no-install           disable installation of missing version (default true)
  -c, --remote-conf string   path to remote configuration file (advanced settings)
  -u, --remote-url string    remote url to install from
  -w, --working-dir          create .terraform-version file in working directory

Global Flags:
  -q, --quiet              no unnecessary output (and no log)
  -r, --root-path string   local path to install versions of OpenTofu, Terraform, Terragrunt, and Atmos (default "C:\\Users\\Denis\\.tenv")      
  -v, --verbose            verbose output (and set log level to Trace)

no compatible version found locally

@Nmishin
Copy link
Collaborator Author

Nmishin commented Jun 20, 2024

$ tenv tf use latest works good if no versions present locally.
$ tenv tf use latest will use the last one version presented locally, I'm not sure that this is expected behaviour, but this is different question.

Could you please try to reproduce the issue like this:

$ tenv tf list
* 1.2.0 (set by /Users/nmishin/.tenv/Terraform/version)
  1.3.0
  1.5.7
  1.6.0
  1.6.1
  1.8.0
$ tenv tf use 1.3.7
Written 1.3.7 in /Users/nmishin/.tenv/Terraform/version
$ terraform version
Failure during terraform call : fork/exec /Users/nmishin/.tenv/Terraform/1.3.7/terraform: no such file or directory
$ tenv --version
tenv version 2.1.6

@dvaumoron
Copy link
Contributor

Got it, you use a specific version, so tenv did not search what it mean in either case, and the message did not help, we should improve that...

@dvaumoron
Copy link
Contributor

$ tenv tf use latest will use the last one version presented locally, I'm not sure that this is expected behaviour, but this is different question.

In my opinion, we don't need to manage that, because Terraform and OpenTofu already warn there user when a new version is available

@dvaumoron dvaumoron self-assigned this Jun 22, 2024
dvaumoron added a commit that referenced this issue Jun 22, 2024
Signed-off-by: Denis Vaumoron <dvaumoron@gmail.com>
dvaumoron added a commit that referenced this issue Jun 22, 2024
Signed-off-by: Denis Vaumoron <dvaumoron@gmail.com>
dvaumoron added a commit that referenced this issue Jun 22, 2024
* Improve message when auto install disabled  #172
* normal display when installation is missing #172

Signed-off-by: Denis Vaumoron <dvaumoron@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants