hashicorp / terraform-plugin-docs

Generate and validate Terraform plugin/provider documentation.
Mozilla Public License 2.0
222 stars 69 forks source link

Stronger emphasis on `Deprecated` schema fields #34

Open nmuesch opened 3 years ago

nmuesch commented 3 years ago

Currently, when a field in a schema is deprecated, it shows up in parenthesis next to whether it's required or not.

Live example here under thresholds - https://registry.terraform.io/providers/DataDog/datadog/latest/docs/resources/monitor#optional

thresholds (Map of String, Deprecated) Alert thresholds of the monitor.

Could the fact that a field is deprecated be more strongly represented? A few ideas for this may be -

Thanks for this project 🙂

andreaangiolillo commented 9 months ago

Could you also include the deprecation message associated with the field in the description?

bflad commented 8 months ago

Drive-by note about potentially including the deprecation message that can be included in attribute definitions. Currently this information is not possible to inject into the documentation generation because this tool is dependent on information output via the Terraform Plugin Protocol and the terraform providers schema -json command. They only expose deprecation as a boolean true/false today. There have been some considerations about exposing the existing deprecation message string as a "quick win" across the protocol (and also help fix empty messaging shown in editors, such as https://github.com/hashicorp/terraform-ls/issues/1538), however it may make more sense to encode and send more structured information from providers to help editors and other tools actually remediate these deprecations and many other configuration refactoring situations (code actions in editor terminology). Since that discovery and implementation effort might take a bit of time based on prioritization, I think we can be pragmatic to include the existing data though since there are situations where a deprecation might not be directly usable as this sort of code action.