Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform binary not found #547

Closed
manotux opened this issue Jul 30, 2024 · 6 comments
Closed

Terraform binary not found #547

manotux opened this issue Jul 30, 2024 · 6 comments
Labels
question Further information is requested

Comments

@manotux
Copy link

manotux commented Jul 30, 2024

The terraform cli tool is installed:

$ terraform version
Terraform v1.6.3-dev
on linux_amd64
                                                                                                                                                                                                                  
$ whereis terraform                                                                                                           
terraform: /usr/bin/terraform

The linux amd64 binary was downloaded:

$ whereis aztfexport
aztfexport: /usr/local/bin/aztfexport

$ aztfexport -v                                            
aztfexport version v0.14.2(523f5b8)

But for any command I get the following error stating the terraform binary is not found in $PATH

 error finding a terraform exectuable: unable to find, install, or build from 1 sources: 1 error occurred:
        * terraform: executable file not found in $PATH       

Any clues?

@magodo
Copy link
Collaborator

magodo commented Jul 31, 2024

@manotux There might be several reasons:

  • The /usr/bin/ is not in your PATH environment variable (though not likely)
  • The terraform executable is not executable. You can check its mode by ls -l /usr/bin/terraform

@magodo magodo added the question Further information is requested label Jul 31, 2024
@manotux
Copy link
Author

manotux commented Jul 31, 2024

Thanks for the quick reply.

I've been able to use the terraform binary normally, so I don't think the $PATH or binary exec permission are a problem here. Just in case:

$ ls -l /usr/bin/terraform
-rwxr-xr-x 1 root root 80900136 Nov  2  2023 /usr/bin/terraform

Somehow this code or hc-install is not being able to identity the binary in my system correctly. Any ideas in how to resolve this? I use Kali 2024.2 distro.

Thanks

@magodo
Copy link
Collaborator

magodo commented Aug 1, 2024

@manotux The hc-install has also a version constraint on the terraform, which must be >=0.12. Would you please check the terraform version installed on your host?

return i.Ensure(ctx, []src.Source{
&fs.Version{
Product: product.Terraform,
Constraints: version.MustConstraints(version.NewConstraint(">=0.12")),
},
})

@manotux
Copy link
Author

manotux commented Aug 2, 2024

@magodo I had already checked that, the terraform version installed is 1.6.3-dev, the one provided on Kali 2024.02.

$ terraform version
Terraform v1.6.3-dev
on linux_amd64

Your version of Terraform is out of date! The latest version
is 1.9.3. You can update by downloading from https://www.terraform.io/downloads.html
$ dpkg -l terraform                       
ii  terraform      1.6.3-0kali1 amd64        tool for building, changing, and versioning infrastructure

@magodo
Copy link
Collaborator

magodo commented Aug 5, 2024

With:

func main() {
	c := version.MustConstraints(version.NewConstraint(">=0.12"))
	v := version.Must(version.NewSemver("v1.6.3-dev"))
	fmt.Println(c.Check(v))
}

It prints: false

With v1.6.3, it prints true.

See hashicorp/go-version#36 (comment) for why. So we'd suggest you to install a released version of terraform.

@manotux
Copy link
Author

manotux commented Aug 5, 2024

Thanks for your time and verification. I'll consider installing the project binaries rather than using the ones provided by Kali. I've never thought it was a good idea to include strings like '-dev' on package versions; it's not the first time I've seen an issue like that when parsing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants