You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to be able to let terraform-plugin-docs (which uses terraform-json) generate the documentation for a provider and also append the default value of an attribute, if given.
For example given the entry
"rm": {
Type: schema.TypeBool,
Description: "If true, then <omitted for brevity>.",
Default: false,
Optional: true,
},
I'd like to have the rendered output in the .md file as follows:
-**rm** (Boolean) If true, then <omittedforbrevity>. Defaults to `false`
Current Terraform Version
Terraform v0.15.3
on darwin_amd64
Current tool versions
terraform-plugin-docs: v0.4.0
terraform-plugin-sdk/v2 v2.6.1
Use-cases
Attempted Solutions
For now I can simply add the value to the Description as follows:
"rm": {
Type: schema.TypeBool,
Description: "If true, then <omitted for brevity>. Defaults to `false`",
Default: false,
Optional: true,
},
Thanks for the feedback here. The default values you see are implemented by a particular provider SDK, not Terraform itself. The Default field is not included in the provider plugin protocol, and is not seen by the terraform cli. Many Default values are also filled it via functions evaluated during planning, which are not representable in the schema protocol at all, leaving the same problem with displaying the defaults even if Default was added as part of the schema.
Since this is implemented by the plugin SDK, that project repository would be the starting point for a discussion about extending the schema protocol to expose default values. See also #28657 for a similar request.
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.
I would like to be able to let
terraform-plugin-docs
(which usesterraform-json
) generate the documentation for a provider and also append the default value of an attribute, if given.For example given the entry
I'd like to have the rendered output in the
.md
file as follows:Current Terraform Version
Current tool versions
v0.4.0
v2.6.1
Use-cases
Attempted Solutions
For now I can simply add the value to the
Description
as follows:Proposal
Add the attribute
Default
here:terraform/command/jsonprovider/attribute.go
Lines 10 to 20 in 4b25a07
References
The text was updated successfully, but these errors were encountered: