tfenv
tfenv copied to clipboard
Feature Request: Create TFENV_TF_VERSION
Feature Request:
Create TFENV_TF_VERSION variable that has current selected version. So that I may use that in my prompt.
Thanks.
Wouldn't terraform --version
itself suffice? i.e.:
$ terraform --version --json | jq -r .terraform_version
1.5.5
$
Note that tfenv is meant to "dynamically" load Terraform, so it may happen that no terraform at all is activated at any given prompt, i.e.:
$ terraform --version --json | jq -r .terraform_version
Specifically asked for min-required via terraform{required_version}, but none found
$
You can even run into a prompt where not even tfenv is active, i.e.:
$ terraform --version --json | jq -r .terraform_version
Command 'terraform' not found
$
You'll have to cope with that case one way or the other.
Maybe https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/terraform is what you're looking for?