user27008283
user27008283

Reputation: 35

Terraformer Import Error: exec: no command When Importing AWS Resources on Windows

I'm trying to use Terraformer on Windows to import my AWS resources into Terraform configuration files. I have Terraform and Terraformer installed, but I'm encountering an error when running the import command.

My Setup:

C:\Users\user>aws --version
aws-cli/2.9.17 Python/3.9.11 Windows/10 exe/AMD64 prompt/off

C:\Users\user>terraform version
Terraform v1.9.4
on windows_386

Your version of Terraform is out of date! The latest version
is 1.9.5. You can update by downloading from https://www.terraform.io/downloads.html

C:\Users\user>terraformer version
Terraformer v0.8.13
C:\Users\user>where aws
C:\Program Files\Amazon\AWSCLIV2\aws.exe

C:\Users\user>where terraform
C:\Program Files\Terraform\terraform.exe

C:\Users\user>where terraformer
C:\ProgramData\chocolatey\bin\terraformer.exe

C:\Users\user>set
Terraform=C:\Program Files\Terraform
Terraformer=C:\ProgramData\chocolatey\bin\
AWS CLI=C:\Program Files\Amazon\AWSCLIV2
Terraform: v1.9.4 (Windows 386)

Terraformer: v0.8.24

AWS CLI is configured correctly and can list S3 buckets without issues.

Command I'm Running:

terraformer import aws --resources=s3 --regions=us-west-3

Error Output:

2024/09/02 20:56:18 aws importing default region
2024/09/02 20:56:18 exec: "": executable file not found in %PATH%

I've tried the following solutions:

Verified that both Terraform and Terraformer are installed for the correct architecture. Tried specifying the path to the terraform.exe explicitly. Checked and updated environment variables related to Terraform, AWS and Terraformer. Updated Terraformer to the latest version.

Despite these attempts, the issue persists. Has anyone encountered a similar issue or knows how to resolve this error? Any help would be appreciated!

Upvotes: 1

Views: 435

Answers (1)

Nicola Di Santo
Nicola Di Santo

Reputation: 11

I had the same issue, it appers to be a mismatch between terraform and terraformer: I have installed terraform 386 binaries and dowloaded terraformer with choco. I have solved by:

  1. unistalling terraform and terraformer
  2. downloading binaries of terraform amd64 from https://developer.hashicorp.com/terraform/install#windows and save them to C:\terrafrom\ folder.
  3. downloading terraformer-aws-windows-amd64.exe from https://github.com/GoogleCloudPlatform/terraformer/releases to C:\terrafrom\ and rename it as terraformer.exe
  4. adding C:\terrafrom\ to path env var
  5. in a folder, from cli: terraform init and then terraformer import ...

Upvotes: 1

Related Questions