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

Add information about update-ability, default value, & validation #398

Open
1 task done
drewmullen opened this issue Aug 27, 2024 · 1 comment
Open
1 task done
Labels
enhancement New feature or request

Comments

@drewmullen
Copy link

drewmullen commented Aug 27, 2024

Terraform CLI and terraform-plugin-docs Versions

latest

Use Cases or Problem Statement

It would be nice for users to know more about a parameters behaviors without having to write lengthy custom descriptions. It would also be nice to be able to have a unified look to documentation so common questions are answered uniformly and generated instead of hand typed.

Specifically it would be nice to know a parameters:

  • default value - if applicable
  • updateability - if it can be updated or requires replacement
  • validators - what types of validations are run against the input

Proposal

Technical implementation is currently limited by missing fields in the schema. That aside, here are some proposals for how to display the information:

- `my_parameter`: <description>
  - Type: <type>  
  - Default: "one"
  - Plan Modifiers: 
    - Forces Recreation
  - Validators:
    - Any one of: `one`, `two`, `three`

How much impact is this issue causing?

Low

Additional Information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@austinvalle
Copy link
Member

Hey there @drewmullen, thanks for the feature request!

As you mentioned, all the information we use today is provided by Terraform core, via the terraform providers schema -json command. Unfortunately that limits us to the information we can provide in tooling like terraform-plugin-docs or the Terraform language server.

A way forward is to start producing additional metadata from the provider binary itself (and perhaps additionally pre-generating that metadata in a static file, hosted by a CDN, etc.) so that tooling like terraform-plugin-docs can make use of it. If you (or others) are interested, we have a Framework GH issue for this exact concept: hashicorp/terraform-plugin-framework#1022

Once metadata is available from the providers, we can start giving more specific implementation metadata to downstream tools, which luckily for terraform-plugin-framework, is already defined, so the framework provider ecosystem wouldn't need to implement new interfaces to enable this.

For example: https://github.com/hashicorp/terraform-provider-aws/blob/8d8407e7ae0356cace0234d6accaf30f14a0cedf/internal/framework/validators/ip.go#L18-L21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants