hashicorp / hashicorp/terraform-plugin-docs

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

Open
#363 4 comments 3 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
263
Forks
84
Avg merge
3d 6h
Merged PRs (30d)
2

Description

### 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

```go
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](https://discuss.hashicorp.com/t/plugin-framework-blocks-dont-have-required-field/50180) this is a known issue from while ago, but there was no issue in this repository about the bug.

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.