tfenv icon indicating copy to clipboard operation
tfenv copied to clipboard

Feature Request: Create TFENV_TF_VERSION

Open bytebeast opened this issue 1 year ago • 2 comments

Feature Request:

Create TFENV_TF_VERSION variable that has current selected version. So that I may use that in my prompt.

Thanks.

bytebeast avatar Jul 28 '23 16:07 bytebeast

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.

next-jesusmanuelnavarro avatar Sep 16 '23 09:09 next-jesusmanuelnavarro

Maybe https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/terraform is what you're looking for?

mengesb avatar Sep 22 '23 17:09 mengesb