terraform-plugin-docs icon indicating copy to clipboard operation
terraform-plugin-docs copied to clipboard

Go Generate fails with "Failed to load plugin schemas"

Open independentid opened this issue 3 years ago • 3 comments

Whether on the desktop or in the workflow setup by the Terraform Plugin Framework template, the following error occurs when generating docs (this from the workflow template):

  go generate ./...
3  shell: /usr/bin/bash -e {0}
4 examples/hexa-demo/gcp-iap-cloudrun/main.tf
5 rendering website for provider "terraform-provider-hexa" (as "terraform-provider-hexa")
6 exporting schema from Terraform
7 compiling provider "hexa"
8 using Terraform CLI binary from PATH if available, otherwise downloading latest Terraform CLI binary
9 running terraform init
10 getting provider schema
11 Error executing command: unable to generate website: exit status 1
12 
13 Error: Failed to load plugin schemas
14
15 Error while loading schemas for plugin components: Failed to obtain provider
16 schema: Could not load the schema for provider
17 registry.terraform.io/hashicorp/hexa: failed to instantiate provider
18 "registry.terraform.io/hashicorp/hexa" to obtain schema: Unrecognized remote
19 plugin message: Provider started. To attach Terraform CLI, set the
20 TF_REATTACH_PROVIDERS environment variable with the following:
21 
22 This usually means that the plugin is either invalid or simply
23 needs to be recompiled to support the latest protocol...
24
25
26
27 exit status 1
28 main.go:20: running "go": exit status 1
29 Error: Process completed with exit code 1.

It is not clear if the workflow has a TF_REATTACH_PROVIDERS issue. On the desktop I have tried both ways.

Also, note that the schema being searched for is: "registry.terraform.io/hashicorp/hexa" rather than "registry.terraform.io/hexa-org/hexa".

It is not clear in the documentation or the error if there is a mis-configuration, or other issue.

This error may be related to Issue #141

independentid avatar Jul 03 '22 21:07 independentid

I have found the cause of the issue. In main, the plugin address will not accept a "-" in the organization name. This works: Address: "registry.terraform.io/hexaorg/hexa" This does not: Address: "registry.terraform.io/hexa-org/hexa"

Suggest a diagnostic error for the naming problem or allow for dashes rather than defaulting to "hashicorp".

independentid avatar Jul 05 '22 17:07 independentid

Hello @independentid, if https://github.com/hashicorp/terraform-plugin-docs/pull/174 is merged, I believe it will properly report the error from the terraform cli in situations like this, where a - is invalid in the organization name.

lrstanley avatar Aug 12 '22 04:08 lrstanley