Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/generate: allow
HasExample
and HasImport
to function
When building custom templates, we have `HasExample`[1] and `HasImport`[2] available that return a boolean value and allow templates to include conditionals. Some uses of this would be to only show either an example or import line should the files exist. However, when we are calling these for templates both data-sources and resources only pass in an empty string[3] resulting in the value always returning `false`[4]. This appears to be an oversight as the non-customisable render template call site correctly passes in the values[5] of these paths and the template expression renders. [1]: https://github.com/hashicorp/terraform-plugin-docs/blob/6e1a3339859e55625941bcef8ab365552235ca3b/internal/provider/template.go#L137 [2]: https://github.com/hashicorp/terraform-plugin-docs/blob/6e1a3339859e55625941bcef8ab365552235ca3b/internal/provider/template.go#L140 [3]: https://github.com/hashicorp/terraform-plugin-docs/blob/6e1a3339859e55625941bcef8ab365552235ca3b/internal/provider/generate.go#L420 [4]: https://github.com/hashicorp/terraform-plugin-docs/blob/e52e735a834db7cdbd980cc817989588c77d96d4/internal/provider/template.go#L198 [5]: https://github.com/hashicorp/terraform-plugin-docs/blob/6e1a3339859e55625941bcef8ab365552235ca3b/internal/provider/generate.go##L258
- Loading branch information