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

bug: TypeSet/TypeList Elements are not rendered in data-sources #64

Open
mavogel opened this issue May 13, 2021 · 1 comment
Open

bug: TypeSet/TypeList Elements are not rendered in data-sources #64

mavogel opened this issue May 13, 2021 · 1 comment

Comments

@mavogel
Copy link

mavogel commented May 13, 2021

Current behavior

The descriptions of the nested elements are only rendered in the markdown of the resources, but not the datasources.

  • The schema:
"ipam_config": {
	Type:        schema.TypeSet,
	Description: "The IPAM configuration options",
	Computed:    true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"subnet": {
				Type:        schema.TypeString,
				Description: "The subnet in CIDR form",
				Optional:    true,
				ForceNew:    true,
			},

			"ip_range": {
				Type:        schema.TypeString,
				Description: "The ip range in CIDR form",
				Optional:    true,
				ForceNew:    true,
			},

			"gateway": {
				Type:        schema.TypeString,
				Description: "The IP address of the gateway",
				Optional:    true,
				ForceNew:    true,
			},

			"aux_address": {
				Type:        schema.TypeMap,
				Description: "Auxiliary IPv4 or IPv6 addresses used by Network driver",
				Optional:    true,
				ForceNew:    true,
			},
		},
	},
},

See the rendered markdowns:

Expected behavior

The descriptions of the nested elements in datasources are also rendered in the markdown.

Versions

  • terraform-plugin-docs: v0.4.0
  • terraform-plugin-sdk/v2 v2.6.1
@detro detro changed the title bug: TypeSet Elements are not rendered in data-sources bug: TypeSet/TypeList Elements are not rendered in data-sources Mar 15, 2022
gramsa49 added a commit to AxtonGrams/terraform-provider-wiz that referenced this issue Feb 28, 2023
The description updates are not rendered in the documentation due to this bug:
hashicorp/terraform-plugin-docs#64
@aidan-mundy
Copy link

aidan-mundy commented May 30, 2023

EDIT: This problem might only affect providers using the Terraform Plugin SDKv2. I haven't checked with a provider using the Terraform Plugin Framework

Unfortunately this also appears to affect resources.

This issue is a downstream result of the terraform providers schema -json command utilizing an output format for list/set attributes that contains limited information about the list/set contents. Further upstream, that command relies on this json marshaller, and that json is consumed in terraform-plugin-docs via the terraform-json unmarshalling library.

Example in the current format (note, many of the "string" attributes have associated Descriptions, and they are missing here due to the strange format):

"attributes": {
    "builds": {
        "type": [
            "list",
            [
                "object",
                {
                    "id": "string",
                    "images": [
                        "list",
                        [
                            "object",
                            {
                                "created_at": "string",
                                "id": "string",
                                "region": "string"
                            }
                        ]
                    ],
                    "labels": [
                        "map",
                        "string"
                    ],
                    "updated_at": "string"
                }
            ]
        ],
        "description": "Builds for this iteration.",
        "description_kind": "plain",
        "computed": true
    }
}

If I'm reading the discussion in this PR correctly, it looks like the infrastructure exists in terraform and in the downstream terraform-json to allow terraform providers schema -json to output more detailed information about nested types without moving any mountains, it just isn't being used yet.

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

No branches or pull requests

2 participants