I am developing a custom terraform provider.
Terraform v1.4.4 on darwin_arm64, terraform-plugin-sdk - v2.20.0
I have a nested field in the schema,
"topic_schemas": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"schema": {
Type: schema.TypeString,
Computed: true,
Description: "Kafka topic schema in string format",
},
"schema_id": {
Type: schema.TypeString,
Computed: true,
Description: "Internal schema ID",
},
},
},
},
When i run terraform providers schema -json
on this provider schema, i get this field in attributes
section of the JSON file
"topic_schemas": {
"type": [
"list",
[
"object",
{
"schema": "string",
"schema_id": "string"
}
]
],
"description_kind": "plain",
"computed": true
}
},
Since this is a nested field, it should appear under block_types
section as mentioned here
However, when i add Optional:true
in topic_schemas
the generated JSON shows it correctly in block_types
section. Is this a bug? Since topic_schemas
is a nested block, shouldnt it always go into the block_types
section?