spellingb / tfswitchPS

Powershell utility to switch between Terraform versions
The Unlicense
0 stars 0 forks source link

Terraform Version not updating in new windows terminal tab #1

Open spellingb opened 2 years ago

spellingb commented 2 years ago

After setting the active version of terraform in a powershell session running in Windows Terminal, and then opening a new windows terminal tab in the same window, the Terraform version setting does not carry over.

spellingb commented 2 years ago

When setting the active version, this sets three variables; PATH TFSWITCH_VERSION TFSWITCH_PATH

These variables are set in the current session and are persisted using the [system.environment]::SetEnvironmentVariable Method. When a new tab is opened in an existing Windows Terminal window, the Environment Variables are pulled from the existing Windows Terminal Parent, instead of loading the most current.

This issue is tracked here

Workaround is to:

kvendingoldo commented 6 months ago

btw. you can also use tenv that support Terraform as well as OpenTofu (and Terragrunt :) ) in one tool. It allow you to simplify version management and can do much more, than tfswitch.