Failed to instantiate provider "registry.terraform.io/hashicorp/aws" to obtain schema: fork/exec

I have terraform init and it is done successfully. I’m having following error while doing terraform plan.

Screenshot from 2021-04-01 12-58-01

“Failed to instantiate provider “registry.terraform.io/hashicorp/aws” to obtain
schema: fork/exec”

Are you using WSL or native Linux?

I’m using debian based kali linux

Hi @dipendra.chaudhary,

Based only on the error message text itself, it seems like the provider plugin program is, for some reason, not marked as executable. Therefore when Terraform Core tries to launch it, the operating system refuses to start the program.

One reason that could happen is if your working directory is on a filesystem that doesn’t support executable permissions. Some reasons that might be true are if it’s mounted with the noexec option, or if it’s a physical filesystem not tailored for Unix such as FAT32.

You might be able to inspect the permissions by looking at a directory listing of that directory where Terraform’s provider installer cached the executable:

ls -l .terraform/providers/registry.terraform.io/hashicorp/aws/3.34.0/linux_amd64

On my system that produces the following:

total 168668
-rwxr-xr-x 1 mart mart 172716032 Apr  1 15:57 terraform-provider-aws_v3.34.0_x5

The mode in the first column of the output shows x representing “executable”, and so this program is executable on my system. It seems like on your system it isn’t, in which case you might see some other mode pattern like -rw-r--r--.

You could try manually setting the executable permission to see if that helps:

chmod +x .terraform/providers/registry.terraform.io/hashicorp/aws/3.34.0/linux_amd64/.terraform/providers/registry.terraform.io/hashicorp/aws/3.34.0/linux_amd64

However, if your filesystem is configured not to support executable files at all then I expect that operation will make no difference; if you run the ls command again after running it you’d probably see no change.

If there’s anything unusual about how you’re running Linux here – for example, if you’re running inside Docker or inside Windows Subsystem for Linux (WSL) or in a virtual machine with directories shared with the host machine, it’d help to mention that here because virtualization layers like that can potentially constrain which filesystem features are usable.