File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,6 +76,10 @@ func (r *Resource) InternalValidate() error {
7676 }
7777
7878 switch t := v .Elem .(type ) {
79+ case * Resource :
80+ if err := t .InternalValidate (); err != nil {
81+ return err
82+ }
7983 case * Schema :
8084 bad := t .Computed || t .Optional || t .Required
8185 if bad {
Original file line number Diff line number Diff line change @@ -108,6 +108,42 @@ func TestResourceInternalValidate(t *testing.T) {
108108 },
109109 true ,
110110 },
111+
112+ // Sub-resource invalid
113+ {
114+ & Resource {
115+ Schema : map [string ]* Schema {
116+ "foo" : & Schema {
117+ Type : TypeList ,
118+ Elem : & Resource {
119+ Schema : map [string ]* Schema {
120+ "foo" : new (Schema ),
121+ },
122+ },
123+ },
124+ },
125+ },
126+ true ,
127+ },
128+
129+ // Sub-resource valid
130+ {
131+ & Resource {
132+ Schema : map [string ]* Schema {
133+ "foo" : & Schema {
134+ Type : TypeList ,
135+ Elem : & Resource {
136+ Schema : map [string ]* Schema {
137+ "foo" : & Schema {
138+ Type : TypeInt ,
139+ },
140+ },
141+ },
142+ },
143+ },
144+ },
145+ false ,
146+ },
111147 }
112148
113149 for i , tc := range cases {
You can’t perform that action at this time.
0 commit comments