elastic / terraform-provider-ec

https://registry.terraform.io/providers/elastic/ec/latest/docs
Apache License 2.0
176 stars 88 forks source link

Latest released version 0.11.0 fails to instantiate provider "registry.terraform.io/elastic/ec" to obtain schema: fork/exec on Windows operating system #853

Open avwsolutions opened 2 months ago

avwsolutions commented 2 months ago

Readiness Checklist

Expected Behavior

terraform plan should generate a plan file that contains the EC(E) platform infrastructure deployment based on the tf defined resources and current state. This fails.

Current Behavior

terraform init --upgrade runs smoothly and downloads the artifact to the directory structure. So the artifact is available to be executed. Also the file permissions are set the same as the older downloaded versions, so this isn't conflicted.

terraform plan generates an Error: Failed to load plugin schemas on WIndows 11, which relates to loading the actual schema of the provider. This fails with a fork/exec to instantiate the provider. See full message below.

│ registry.terraform.io/elastic/ec: failed to instantiate provider "registry.terraform.io/elastic/ec" to obtain schema: fork/exec

│ .terraform/providers/registry.terraform.io/elastic/ec/0.11.0/windows_amd64/terraform-provider-ec_v0.11.0.exe: Access is denied... 

Downgrading to an older version like 0.10.0 solves the issue.

 Terraform definition

Steps to Reproduce

  1. Bump the terraform provider (ec) version = "0.11.0" .
  2. terraform init -upgrade.
  3. terraform plan
  4. Failure happens.

Context

We cannot upgrade to the latest released version and benefit the new features and fixes.

Possible Solution

Seems like a Build issue.

Your Environment

Logs

$ terraform init --upgrade

Initializing the backend...

Upgrading modules...

- elastic-environments in ..\..\..\modules\elastic-environments 

Initializing provider plugins...

- Finding elastic/ec versions matching "0.11.0"...
- Installing elastic/ec v0.11.0...
- Installed elastic/ec v0.11.0 (signed by a HashiCorp partner, key ID 7FE579EDEC6DAA7B) 

Partner and community providers are signed by their developers.

If you'd like to know more about provider signing, you can read about it here:

https://www.terraform.io/docs/cli/plugins/signing.html

Terraform has made some changes to the provider dependency selections recorded

in the .terraform.lock.hcl file. Review those changes and commit them to your

version control system if they represent changes you intended to make.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see

any changes that are required for your infrastructure. All Terraform commands

should now work.

If you ever set or change modules or backend configuration for Terraform,

rerun this command to reinitialize your working directory. If you forget, other

commands will detect it and remind you to do so if necessary.

$ terraform plan

╷

│ Error: Failed to load plugin schemas

│

│ Error while loading schemas for plugin components: Failed to obtain provider schema: Could not load the schema for provider

│ registry.terraform.io/elastic/ec: failed to instantiate provider "registry.terraform.io/elastic/ec" to obtain schema: fork/exec

│ .terraform/providers/registry.terraform.io/elastic/ec/0.11.0/windows_amd64/terraform-provider-ec_v0.11.0.exe: Access is denied... 
gigerdo commented 2 months ago

I tried the same on windows with the amd64 provider and couldn't reproduce it: The provider could be executed.

It sounds like the locally installed provider exe maybe has the wrong access permissions (So terraform can't read it).

One thing to try would be to delete the provider and re-download them: