Open b-rad36 opened 2 years ago
@b-rad36 Thank you for the patch. I also forgot to consider unofficial community providers.
I guess redirecting legacy URLs work only for backward compatibility before the registry exists and it doesn't work newly added community providers because there is no way to know their namespace. That is to say, depending on legacy URLs is not only fragile, but also never be comprehensive solution.
I think a simple solution is adding a new flag such as -source=okta/okta
, which accepts a provider source syntax in Terraform v0.13+. This looks a bit redundant for browse
command, but would be comprehensive solution.
An alternative is peeking into a lock file a.k.a .terraform.lock.hcl
in Terraform v0.14+. Actually show
and list
commands have already peek into the lock file to find provider binary. It would work for most of case except for a case found duplicated entries using provider alias with a forked provider. A notable requirement using the lock file is that we need to run browse
command in an initialized root module directory. It's not required for official providers, so peeking into the lock file should be optional and just ignore if not found.
Previous fix (0.7.2) for Resource/Data Doc URLs didn't work for non-Hashicorp providers. Hashicorp providers, like AWS, Azure, Kubernetes are now working but the non-Hashicorp URLs generated from
tfschema resource/data provider <name>
are going to a 404 page.Example:
Creates the link:
https://registry.terraform.io/providers/hashicorp/okta/latest/docs/resources/group
The correct link:https://registry.terraform.io/providers/okta/okta/latest/docs/resources/group
Note that the URL should be using
/providers/okta/okta/
and not/providers/hashicorp/okta/
.This PR reverts the
docBaseURL
constant andbuildXDocURL
functions to their previous format but with the.html
suffix removed for Data and Resource URLs.Verify that the following are working: