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

template vars .Type & .Name are back to front? #43

Closed
OJFord opened this issue Mar 4, 2021 · 2 comments · Fixed by #44
Closed

template vars .Type & .Name are back to front? #43

OJFord opened this issue Mar 4, 2021 · 2 comments · Fixed by #44
Milestone

Comments

@OJFord
Copy link
Contributor

OJFord commented Mar 4, 2021

For the resource template excerpt:

# {{.Type}} `{{.Name}}`

v0.4.0 generates (for an AWS VPC resource, say):

# aws_vpc `Resource`

which is certainly backwards from the perspective of the rendered page, but surely it's right to expect that .Type would be "Resource" and .Name "aws_vpc", rather than vice versa?

I initially got that template from the Unifi provider linked in the readme here, but I note now that it doesn't use resource templates, and there's a sensible default if you don't need to add something to the template. So I've actually done that myself too now, and as a result this isn't really an issue for me, just thought I'd mention it 🙂.

@OJFord
Copy link
Contributor Author

OJFord commented Mar 4, 2021

Seems to come from here:

render, err := tmpl.Render("Data Source", providerName, resName, "", "", resSchema)

and here:

render, err := tmpl.Render("Resource", providerName, resName, "", "", resSchema)

when Render actually defines name & typeName in the other order:

func (t resourceTemplate) Render(name, providerName, typeName, exampleFile, importFile string, schema *tfjson.Schema) (string, error) {

OJFord added a commit to OJFord/terraform-plugin-docs that referenced this issue Mar 4, 2021
@detro detro closed this as completed in #44 Mar 15, 2022
detro pushed a commit that referenced this issue Mar 15, 2022
@bflad bflad added this to the v0.7.0 milestone Mar 15, 2022
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants