File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ func ProtoToActionSchema(s *proto.ActionSchema) providers.ActionSchema {
115115func ProtoToListSchema (s * proto.Schema ) providers.Schema {
116116 listSchema := ProtoToProviderSchema (s , nil )
117117 itemCount := 0
118- // check if the provider has set some attributes as required.
118+ // check if the provider has set some attributes/blocks as required.
119119 // When yes, then we set minItem = 1, which
120120 // validates that the configuration contains a "config" block.
121121 for _ , attrS := range listSchema .Body .Attributes {
@@ -124,8 +124,14 @@ func ProtoToListSchema(s *proto.Schema) providers.Schema {
124124 break
125125 }
126126 }
127+ for _ , block := range listSchema .Body .BlockTypes {
128+ if block .MinItems > 0 {
129+ itemCount = 1
130+ break
131+ }
132+ }
127133 return providers.Schema {
128- Version : listSchema .Version ,
134+ Version : s .Version ,
129135 Body : & configschema.Block {
130136 Attributes : map [string ]* configschema.Attribute {
131137 "data" : {
Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ func ProtoToActionSchema(s *proto.ActionSchema) providers.ActionSchema {
121121func ProtoToListSchema (s * proto.Schema ) providers.Schema {
122122 listSchema := ProtoToProviderSchema (s , nil )
123123 itemCount := 0
124- // check if the provider has set some attributes as required.
124+ // check if the provider has set some attributes/blocks as required.
125125 // When yes, then we set minItem = 1, which
126126 // validates that the configuration contains a "config" block.
127127 for _ , attrS := range listSchema .Body .Attributes {
@@ -130,6 +130,12 @@ func ProtoToListSchema(s *proto.Schema) providers.Schema {
130130 break
131131 }
132132 }
133+ for _ , block := range listSchema .Body .BlockTypes {
134+ if block .MinItems > 0 {
135+ itemCount = 1
136+ break
137+ }
138+ }
133139 return providers.Schema {
134140 Version : listSchema .Version ,
135141 Body : & configschema.Block {
You can’t perform that action at this time.
0 commit comments