Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc generator uses wrong registry #141

Open
KyloRilo opened this issue May 26, 2022 · 9 comments
Open

Doc generator uses wrong registry #141

KyloRilo opened this issue May 26, 2022 · 9 comments

Comments

@KyloRilo
Copy link

Whenever I attempt to run tfplugindocs generate it assumes that my provider is under the hashicorp registry. Is there a way to pass in your own registry and provider instead of it defaulting to hashicorp?
The error I get is:
`
Error executing command: unable to generate website: exit status 1

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/hashicorp/{my_provider}: failed to instantiate provider
"registry.terraform.io/hashicorp/{my_provider}" to obtain schema: Unrecognized
remote plugin message: open : no such file or directory
`

How can I get the registry to actually use "registry.terraform.io/{my_org}/{my_provider}"

@independentid
Copy link

I have this same issue. Also, what if the plugin is in development and not registered. What address should be used?

@lrstanley
Copy link

I believe this is a non-issue. The registry path used is merely just a temporary configuration for querying the schema, and I don't believe it needs to match the actual provider location. It uses that as a placeholder for the temporary directory so that way the terraform cli picks it up (see here), and builds your provider, writing the binary to that temporary location as if it were actually on the registry.

For example, I am utilizing the latest tfplugindocs today, building an internal provider that uses a different hostname, and isn't pushed to the registry, and I'm able to build without issue.

This makes me think the problem you're running into is something else, like a slight naming misconfiguration somewhere. I'd make sure the provider name you're passing in is just the shorthand version of the provider (e.g. --provider-name for domain.com/myorg/my-provider should just be my-provider).

@independentid
Copy link

I was able to resolve the error by changing the name of the publisher. Previously I was using:
example-org/myProvider

The "-" was causing numerous issues that gave no errors but just caused mysterious failures (like doc generator not working).

Using "exampleorg/myProvider" works.

@gerbil
Copy link

gerbil commented Sep 28, 2023

@independentid where did you change that? im still facing the issue:

Error executing command: unable to generate website: exit status 1

Error: Incompatible provider version

Provider registry.terraform.io/hashicorp/xxx v0.0.1 does not have a
package available for your current platform, windows_386.

Provider releases are separate from Terraform CLI releases, so not all
providers are available for all platforms. Other versions of this provider
may have different platforms supported.

@maidul98
Copy link

The way we fixed this was by setting GOOS and GOARCH to what the error was complaining about

GOOS=darwin GOARCH=amd64 go generate ./...

@gerbil
Copy link

gerbil commented Jan 24, 2024

Not sure what exactly required, but ...

$ GOOS=darwin GOARCH=amd64 tfplugindocs generate ./...         
rendering website for provider "terraform-provider-opswat" (as "terraform-provider-opswat")
exporting schema from Terraform
compiling provider "opswat"
using Terraform CLI binary from PATH if available, otherwise downloading latest Terraform CLI binary
running terraform init
Error executing command: unable to generate website: exit status 1

Error: Incompatible provider version

Provider registry.terraform.io/hashicorp/opswat v0.0.1 does not have a
package available for your current platform, windows_386.

Provider releases are separate from Terraform CLI releases, so not all
providers are available for all platforms. Other versions of this provider
may have different platforms supported.

The same error for
$ GOOS=windows GOARCH=386 tfplugindocs generate ./...

@bflad
Copy link
Contributor

bflad commented Jan 24, 2024

Hi @gerbil 👋 Your error message including does not have a package available for your current platform would likely have a different cause than the original Could not load the schema for provider error. It looks like you also filed #286 for this and there are some suggestions there to ensure both tfplugindocs and terraform binaries are using the same CPU architecture (in your case, either both the 32-bit 386 architecture, or both the 64-bit amd64 architecture if your CPU is 64-bit). That other issue was adjusted into a feature request for tfplugindocs to explicitly warn or error if there is that sort of CPU mismatch between the two binaries. Hope that helps.

@gerbil
Copy link

gerbil commented Jan 25, 2024

After switching to go version it's now working as expected. Thank you!

> go generate
rendering website for provider "terraform-provider-opswat" (as "terraform-provider-opswat")
exporting schema from Terraform
compiling provider "opswat"
using Terraform CLI binary from PATH if available, otherwise downloading latest Terraform CLI binary
running terraform init
getting provider schema
generating missing templates
...

@Luiggi33
Copy link

@bflad 's suggestion fixes the mentioned issue for me! Thank you a lot, very helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants