Skip to content

modify terraform providers schema -json to include fields for default, plan_modifiers, and validators #35646

@drewmullen

Description

@drewmullen

Terraform Version

latest

Use Cases

I want to improve the documentation generated from: https://github.com/hashicorp/terraform-plugin-docs

Attempted Solutions

you can jam a lot of information in to the description field

Proposal

the json schema generated from a provider / resource schema should include information information on:

  • default
  • plan_modifiers
  • validators
"resource_schemas": {
  "resource_name": {
    "version": 0,
    "block": {
      "attributes": {
        "type": {
          "type": "string",
          "description_kind": "plain",
          "optional": true,

          # new fields to add to schema
          "default": "default",
          "validators": [
            "validator description 1"
          ],
          "plan_modifers": [
            "plan mod description 1"
          ]
        }
      },

The plan modifiers could pull from descriptions provided by each. ex: https://github.com/hashicorp/terraform-plugin-framework/blob/main/resource/schema/stringplanmodifier/requires_replace.go#L27

Validators also seem to have the concept: https://github.com/hashicorp/terraform-plugin-framework-validators/blob/main/stringvalidator/any.go#L46

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions