aztfexport icon indicating copy to clipboard operation
aztfexport copied to clipboard

version check problems, misleading error, opentofu

Open angulion opened this issue 1 year ago • 2 comments

While i know aztfexport is "azure terraform export", it is also true that most linux distributions now ship with opentofu ( /usr/bin/tofu ) instead. Like a couple previous issue-reports where version check failed because it was 1.6.3-dev, in my case I have tofu symlinked to terraform (because of aztfexport) and the check likely fails because it says:

OpenTofu v1.8.7
on linux_amd64

instead of Terraform , even if they are functionality wise identical.

Please do one of:

  • Remove the whole check, version <0.12 is likely nowhere to be found anymore.
  • Add a --version-ignore flag so one can skip the check at own risk
  • If must, check for "OpenTofu" as well as for "Terraform" in aztfexport/internal/meta/tfinstall_find.go

At the very least, have a error message that states what the actual error is (product, version?), because in all these 3 issues now the error aztfexport (below) has given is just misleading - terraform has been in the path. Especially since it is not mentioned that aztfexport actually checks for product/version.

Misleading error:

> whereis terraform
terraform: /usr/bin/terraform
> aztfexport query True|less -X 
  
   Microsoft Azure Export for Terraform 
  
  ⣽  Initializing...  
   Microsoft Azure Export for Terraform 
  
  error finding a terraform exectuable: unable to find, install, or build from 1 sources: 1 error occurred:
        * terraform: executable file not found in $PATH  

(Had less in pipe to prevent aztfexport from clearing screen)

Additionally, config could have a terraform_executabe setting where one could specify from where aztfexport should run terraform/tofu.

angulion avatar Dec 20 '24 16:12 angulion

We haven't been investigating to opentofu at this moment. Whilst I recognize there are more distributions come with opentofu, supporting it can make user's life easier. @stemaMSFT WDYT?

magodo avatar Dec 20 '24 23:12 magodo

@angulion we will keep this issue open and see if more upvotes come in to support this. For now, we'll be investigating new items due to unfortunate limited bandwidth, but this issue will be on our monitoring list.

stemaMSFT avatar Jan 07 '25 00:01 stemaMSFT