Skip to content

Required blocks in resources implemented with terraform-plugin-framework are listed as optional #363

Open
@kangasta

Description

@kangasta

Terraform CLI and terraform-plugin-docs Versions

Terraform v1.8.2
on darwin_arm64

require github.com/hashicorp/terraform-plugin-docs v0.19.1

Provider Code

func (r *networkResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
	resp.Schema = schema.Schema{
		Attributes: map[string]schema.Attribute{
			// Omitted
		},
		Blocks: map[string]schema.Block{
			"ip_network": schema.ListNestedBlock{
				NestedObject: schema.NestedBlockObject{
					Attributes: map[string]schema.Attribute{
						// Omitted
					},
				},
				Validators: []validator.List{
					listvalidator.IsRequired(),
					listvalidator.SizeBetween(1, 1),
				},
			},
		},
	}
}

Expected Behavior

ip_network block is listed as required (with min and max items)

Actual Behavior

ip_network block is listed as optional

Steps to Reproduce

  1. tfplugindocs with provider that has required blocks implemented with terraform-plugin-framework.

How much impact is this issue causing?

Medium

Logs

No response

Additional Information

Based on discussion in discuss.hashicorp.com this is a known issue from while ago, but there was no issue in this repository about the bug.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions