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

Fix URLs generated for non-Hashicorp providers #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions command/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import (
"github.com/mitchellh/cli"
)

const docBaseURL = "https://registry.terraform.io/providers/hashicorp/"
const latestDocs = "/latest/docs"
const docBaseURL = "https://www.terraform.io/docs/providers/"

// Meta are the meta-options that are available on all or most commands.
type Meta struct {
Expand All @@ -28,8 +27,8 @@ func detectProviderName(name string) (string, error) {

func buildProviderDocURL(providerName string) (string, error) {
// build a doc URL like this
// https://registry.terraform.io/providers/hashicorp/aws/latest/docs
url := docBaseURL + providerName + latestDocs
// https://www.terraform.io/docs/providers/aws/index.html
url := docBaseURL + providerName + "/index.html"
return url, nil
}

Expand All @@ -40,8 +39,8 @@ func buildResourceDocURL(resourceType string) (string, error) {
}

// build a doc URL like this
// https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group
url := docBaseURL + s[0] + latestDocs + "/resources/" + s[1]
// https://www.terraform.io/docs/providers/aws/r/security_group
url := docBaseURL + s[0] + "/r/" + s[1]
return url, nil
}

Expand All @@ -52,8 +51,8 @@ func buildDataDocURL(dataSource string) (string, error) {
}

// build a doc URL like this
// https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group
url := docBaseURL + s[0] + latestDocs + "/data-sources/" + s[1]
// https://www.terraform.io/docs/providers/aws/d/security_group
url := docBaseURL + s[0] + "/d/" + s[1]
return url, nil
}

Expand Down
6 changes: 3 additions & 3 deletions command/meta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestBuildProviderDocURL(t *testing.T) {
{
desc: "simple",
name: "aws",
want: "https://registry.terraform.io/providers/hashicorp/aws/latest/docs",
want: "https://www.terraform.io/docs/providers/aws/index.html",
ok: true,
},
}
Expand Down Expand Up @@ -84,7 +84,7 @@ func TestBuildResourceDocURL(t *testing.T) {
{
desc: "simple",
name: "aws_security_group",
want: "https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group",
want: "https://www.terraform.io/docs/providers/aws/r/security_group",
ok: true,
},
{
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestBuildDataDocURL(t *testing.T) {
{
desc: "simple",
name: "aws_security_group",
want: "https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/security_group",
want: "https://www.terraform.io/docs/providers/aws/d/security_group",
ok: true,
},
{
Expand Down