tfenv icon indicating copy to clipboard operation
tfenv copied to clipboard

Installing on new machine isnt working...

Open danpetitt opened this issue 2 months ago • 2 comments

I havent had a problem before, but have just cloned the repo to my new machine in my Ubuntu 22 WSL distro and its not quite working.

When I try and execute terraform I get the following output:

xxx@xxx:~/my-stack/terraform$ terraform
' is not installed (set by /home/xxx/my-stack/terraform/.terraform-version). Installing now as TFENV_AUTO_INSTALL==true
Terraform v1.9.7 is already installed
/terraform: No such file or directoryine 71: /home/xxx/.tfenv/versions/1.9.7

tfenv is working fine:

xxx@xxx:~/my-stack/terraform$ tfenv use
Switching default version to v1.9.7
Default version file overridden by /home/xxx/my-stack/terraform/.terraform-version, changing the default version has no effect
Default version (when not overridden by .terraform-version or TFENV_TERRAFORM_VERSION) is now: 1.9.7

Any help to try and fix would be appreciated.

danpetitt avatar Nov 09 '25 20:11 danpetitt

Please could you export TFENV_DEBUG=1, run the command again and paste the resultant debug logs here? And could you cat -vet .terraform-version and paste that here as well please?

worzel666 avatar Nov 09 '25 22:11 worzel666

Here you go:

xxx@xxx:~/myprojects/my-stack/terraform$ cat -vet .terraform-version
v1.9.7^M$

Debug output:

[DEBUG] Sourcing helpers from /home/xxx/.tfenv/lib/helpers.sh
DEBUG trap set
Helpers sourced successfully
$PATH does not contain '/home/xxx/.tfenv/libexec', prepending and exporting it now
$PATH already contains '/home/xxx/.tfenv/bin', not adding it again
program="terraform"
/home/xxx/.tfenv
Getting version from tfenv-version-name
We are not hardcoded by a TFENV_TERRAFORM_VERSION environment variable
Looking for a version file in /home/xxx/myprojects/terraform
Found at /home/xxx/myprojects/terraform/.terraform-version
TFENV_VERSION_FILE retrieved from tfenv-version-file: /home/xxx/myprojects/terraform/.terraform-version
TFENV_VERSION specified in TFENV_VERSION_FILE: v1.9.7
TFENV_VERSION does not use "latest" keyword
Version Requested is prefixed with a v. Stripping the v.
' is not installed (set by /home/xxx/myprojects/terraform/.terraform-version)
TFENV_VERSION is 1.9.7
Looking for a version file in /home/xxx/myprojects/terraform
Found at /home/xxx/myprojects/terraform/.terraform-version
' is not installed (set by /home/xxx/myprojects/terraform/.terraform-version). Installing now as TFENV_AUTO_INSTALL==true
TFENV_HELPERS is set, not sourcing helpers again
$PATH already contains '/home/xxx/.tfenv/libexec', not adding it again
$PATH already contains '/home/xxx/.tfenv/bin', not adding it again
Resolving version with: tfenv-resolve-version 
TFENV_HELPERS is set, not sourcing helpers again
$PATH already contains '/home/xxx/.tfenv/libexec', not adding it again
$PATH already contains '/home/xxx/.tfenv/bin', not adding it again
Looking for a version file in /home/xxx/myprojects/terraform
Found at /home/xxx/myprojects/terraform/.terraform-version
Version File: /home/xxx/myprojects/terraform/.terraform-version
Version File (/home/xxx/myprojects/terraform/.terraform-version) is not the default ${TFENV_CONFIG_DIR}/version (/home/xxx/.tfenv/version)
Version Requested: v1.9.7
Version Requested is prefixed with a v. Stripping the v.
Version is explicit: 1.9.7. Regex enforces the version: ^1.9.7$
Processing install for version 1.9.7, using regex ^1.9.7$
TFENV_HELPERS is set, not sourcing helpers again
$PATH already contains '/home/xxx/.tfenv/libexec', not adding it again
$PATH already contains '/home/xxx/.tfenv/bin', not adding it again
TFENV_REMOTE: https://releases.hashicorp.com
Terraform v1.9.7 is already installed
/terraformH added to PATH: /home/xxx/.tfenv/versions/1.9.7
/terraform fmt -recursivenv/versions/1.9.7
/terraform: No such file or directoryine 71: /home/xxx/.tfenv/versions/1.9.7

danpetitt avatar Nov 10 '25 14:11 danpetitt