@@ -226,6 +226,14 @@ func TestParsingModuleSchemaOverrides(t *testing.T) {
226
226
},
227
227
},
228
228
})
229
+
230
+ assert .Equal (t , testSchemaOverride .PartialSchema .RequiredInputs , []resource.PropertyKey {
231
+ "example_input" ,
232
+ })
233
+
234
+ assert .Equal (t , testSchemaOverride .PartialSchema .NonNilOutputs , []resource.PropertyKey {
235
+ "example_output" ,
236
+ })
229
237
}
230
238
231
239
func TestApplyModuleOverrides (t * testing.T ) {
@@ -243,13 +251,14 @@ func TestApplyModuleOverrides(t *testing.T) {
243
251
// We cannot infer which outputs are required or not so everything is optional, initially.
244
252
assert .Empty (t , awsVpcSchema .NonNilOutputs , "required outputs is empty" )
245
253
246
- t .Run ("required outputs are updated" , func (t * testing.T ) {
254
+ t .Run ("required inputs/ outputs are updated" , func (t * testing.T ) {
247
255
moduleOverrides := []* ModuleSchemaOverride {
248
256
{
249
257
Source : string (source ),
250
258
MaximumVersion : "6.0.0" ,
251
259
PartialSchema : & InferredModuleSchema {
252
- NonNilOutputs : []resource.PropertyKey {"vpc_id" },
260
+ NonNilOutputs : []resource.PropertyKey {"vpc_id" },
261
+ RequiredInputs : []resource.PropertyKey {"cidr" },
253
262
},
254
263
},
255
264
}
@@ -259,6 +268,7 @@ func TestApplyModuleOverrides(t *testing.T) {
259
268
overridenSchema := combineInferredModuleSchema (awsVpcSchema , partialAwsVpcSchemaOverride )
260
269
assert .NotNil (t , overridenSchema , "overridden module schema is nil" )
261
270
assert .Contains (t , overridenSchema .NonNilOutputs , resource .PropertyKey ("vpc_id" ), "vpc_id should be required" )
271
+ assert .Contains (t , overridenSchema .RequiredInputs , resource .PropertyKey ("cidr" ), "cidr should be required" )
262
272
})
263
273
264
274
t .Run ("specific fields can be updated" , func (t * testing.T ) {
0 commit comments