Hi there @prakkarp!
As you noted, there is no longer a built-in field to mark blocks as Required
in the plugin-framework. This affects the terraform-plugin-doc tool as it defaults fields to optional if it can’t determine if it’s Required
.
Currently, there are 3 validators that will help you achieve the same functionality as a required block that can be used with ListNestedBlock
, SetNestedBlock
, or SingleNestedBlock
respectively.
-
listvalidator.IsRequired
→ListNestedBlock
-
objectvalidator.IsRequired
→SetNestedBlock
-
setvalidator.IsRequired
→SingleNestedBlock
As for the documentation, currently you’ll have to workaround the documentation generation tool to avoid it being shown as optional by using a manual template.
You can run an initial generation to get your fields/descriptions, then insert them into a template. Here is an example from our cloudinit
provider:
Available fields for use in your templates are documented here