-
Notifications
You must be signed in to change notification settings - Fork 120
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
Generate metadata to allow documentation tooling to include data not included in the Terraform schema. #2024
Conversation
Co-authored-by: Jared Baker <jar-b@users.noreply.github.com>
@@ -0,0 +1,26 @@ | |||
--- | |||
page_title: "{{.Name}} {{.Type}} - {{.ProviderName}}" | |||
subcategory: "{{ index .Metadata "service"}}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adds generic resource/data-source templates to expect and pull in metadata. The existing resource level custom templates will need to be updated as well.
After discussion with members of the terraform-devex team, its likely this will be offered natively through framework/plugin-docs in the near future. So rather than adopt a workaround we will wait for the native solution. |
Community Note
The AWSCC provider relies on terraform-plugin-docs to generate Terraform Registry documentation from resource/data source schema. This limits the information we are able to use during documentation configuration to what is included in the resource schema. In some cases this isn't enough to do what we would like with the documentation. For example, currently we are not able to specify a service category in the Cloud Control documentation which leads to poor navigability of the resources within a service. If we were able to include additional metadata in the schema, we would have more flexibility. Unfortunately this is not something that is likely to be included in the short term in terraform-plugin-docs (hashicorp/terraform-plugin-docs#156).
As a potential workaround, this PR modifies the resource generation code to also emit a metadata file which can include whatever information about a resource you would like to include. A modified version of terraform-plugin-docs (currently fully working in an unpublished fork f-metadata-function) would look for these metadata files during documentation generation, and allow the data to be used in the templates. This PR includes the CloudFormation name for a resource, as well as the service name which can be used to specify a subcategory in the template frontmatter.
Currently only supports resources, will need to extend to data-sources if general shape of the solution accepted.
Tasks