Error downloading modules: Error loading modules: error downloading 'fil

Hi there,

I am getting this issue and unable to come back, when i roll back to 0.11.14 from v12. I am using my windows and this is error when i fire “terraform init”
Initializing modules…

  • module.aws_security_group
    Getting source “…/…/…/…/…/…/modules/aws/network/security-groups”
    Error downloading modules: Error loading modules: error downloading ‘file://C:/Users/sdamrala/Desktop/terraform/modules/aws/network/security-groups’: failed to run mklink .terraform\modules\96f8aeb75410a7374f8ea6557a08407c C:\Users\sdamrala\Desktop\terraform\modules\aws\network\security-groups: exec: “cmd”: executable file not found in %PATH% “”

Hi @Damarla499,

It seems that Terraform here is trying to run the Windows utility mklink.exe in order to create the symlink from the .terraform/modules directory to your actual module directory.

The concerning part of that error message for me is the last part, where it reports that %PATH% is empty. %PATH% is an environment variable that’s supposed to contain a colon-separated list of directories to look into for commands, and it’s usually set automatically by the OS when opening a Command Prompt, so it should not be empty.

Is there anything unusual about how you are running Terraform in this case? For example, are you running it via a wrapper script that might be resetting environment variables, or via some automation that might be running as a Windows service rather than as a logged in user?

You also suggested that this was a new problem after you tried to upgrade to Terraform v0.12 and then rolled back to Terraform v0.11.14. Did you perhaps do that trial upgrade by changing %PATH% to include a new directory with Terraform 0.12 in it, and then accidentally set it to empty string while trying to return to Terraform v0.11.14?

I Added terraform.exe path to environment variable, and path added successfully because with “terraform --version” its showing version 11.14. So, path is good.

I am running terraform script from command prompt, by using terraform init, terraform apply commands.

terraform v0.11.14 is in correct path which i gave to environment variable settings.

i did not find the solution for this.