@@ -396,10 +396,31 @@ func TestTerraformOutputsWithSecretsSupported(t *testing.T) {
396396 },
397397 {
398398 name : "object_property_value" ,
399+
400+ // NOTE: This input does not match the schema's type. The tfValue *should* be wrapped
401+ // in a []any{}. [MakeTerraformOutputs] handles this case, but it shouldn't need to
402+ // and tf should never return it.
399403 tfValue : map [string ]interface {}{
400404 "property_a" : "a" ,
401405 "property_b" : true ,
402406 },
407+ tfType : & schema.Schema {
408+ Type : shim .TypeList ,
409+ Required : true ,
410+ MaxItems : 1 ,
411+ Elem : (& schema.Resource {
412+ Schema : schema.SchemaMap {
413+ "property_a" : (& schema.Schema {
414+ Type : shim .TypeString ,
415+ Optional : true ,
416+ }).Shim (),
417+ "property_b" : (& schema.Schema {
418+ Type : shim .TypeBool ,
419+ Optional : true ,
420+ }).Shim (),
421+ },
422+ }).Shim (),
423+ },
403424 expect : autogold .Expect (resource.PropertyMap {resource .PropertyKey ("objectPropertyValue" ): resource.PropertyValue {
404425 V : resource.PropertyMap {
405426 resource .PropertyKey ("propertyA" ): resource.PropertyValue {
@@ -607,9 +628,8 @@ func TestTerraformOutputsWithSecretsSupported(t *testing.T) {
607628 },
608629 schemaMap ,
609630 schemaInfo ,
610- nil , /* assets */
611- false , /* useRawNames */
612- true , /* supportsSecrets */
631+ nil , /* assets */
632+ true , /* supportsSecrets */
613633 )
614634 tt .expect .Equal (t , result )
615635 })
@@ -638,8 +658,7 @@ func TestTerraformOutputsWithSecretsUnsupported(t *testing.T) {
638658 },
639659 }),
640660 map [string ]* SchemaInfo {},
641- nil , /* assets */
642- false , /*useRawNames*/
661+ nil , /* assets */
643662 false ,
644663 )
645664 assert .Equal (t , resource .NewPropertyMapFromMap (map [string ]interface {}{
@@ -1026,7 +1045,7 @@ func TestDefaults(t *testing.T) {
10261045 }
10271046 inputs , assets , err := makeTerraformInputsForConfig (olds , props , tfs , ps )
10281047 assert .NoError (t , err )
1029- outputs := MakeTerraformOutputs (ctx , f .NewTestProvider (), inputs , tfs , ps , assets , false , true )
1048+ outputs := MakeTerraformOutputs (ctx , f .NewTestProvider (), inputs , tfs , ps , assets , true )
10301049
10311050 // sort the defaults list before the equality test below.
10321051 sortDefaultsList (outputs )
@@ -1072,7 +1091,7 @@ func TestDefaults(t *testing.T) {
10721091 assert .Equal (t , "true" , inputs ["x2stringxbool" ])
10731092 assert .Equal (t , "1" , inputs ["x2stringxint" ])
10741093
1075- outputs = MakeTerraformOutputs (ctx , f .NewTestProvider (), inputs , tfs , ps , assets , false , true )
1094+ outputs = MakeTerraformOutputs (ctx , f .NewTestProvider (), inputs , tfs , ps , assets , true )
10761095
10771096 // sort the defaults list before the equality test below.
10781097 sortDefaultsList (outputs )
@@ -1141,7 +1160,7 @@ func TestDefaultsConflictsWith(t *testing.T) {
11411160
11421161 inputs , assets , err := makeTerraformInputsForConfig (olds , props , tfs , ps )
11431162 assert .NoError (t , err )
1144- outputs := MakeTerraformOutputs (ctx , f .NewTestProvider (), inputs , tfs , ps , assets , false , true )
1163+ outputs := MakeTerraformOutputs (ctx , f .NewTestProvider (), inputs , tfs , ps , assets , true )
11451164 sortDefaultsList (outputs )
11461165
11471166 assert .Equal (t , resource .NewPropertyMapFromMap (map [string ]interface {}{
@@ -1161,7 +1180,7 @@ func TestDefaultsConflictsWith(t *testing.T) {
11611180 inputs , assets , err = makeTerraformInputsForConfig (olds , props , tfs , ps )
11621181 assert .NoError (t , err )
11631182
1164- outputs = MakeTerraformOutputs (ctx , f .NewTestProvider (), inputs , tfs , ps , assets , false , true )
1183+ outputs = MakeTerraformOutputs (ctx , f .NewTestProvider (), inputs , tfs , ps , assets , true )
11651184 sortDefaultsList (outputs )
11661185
11671186 assert .Equal (t , resource .NewPropertyMapFromMap (map [string ]interface {}{
@@ -1195,7 +1214,7 @@ func TestComputedAsset(t *testing.T) {
11951214 }
11961215 inputs , assets , err := makeTerraformInputsNoDefaults (olds , props , tfs , ps )
11971216 assert .NoError (t , err )
1198- outputs := MakeTerraformOutputs (ctx , shimv1 .NewProvider (testTFProvider ), inputs , tfs , ps , assets , false , true )
1217+ outputs := MakeTerraformOutputs (ctx , shimv1 .NewProvider (testTFProvider ), inputs , tfs , ps , assets , true )
11991218 assert .Equal (t , resource.PropertyMap {
12001219 "zzz" : resource.PropertyValue {V : resource.Computed {Element : resource.PropertyValue {V : "" }}},
12011220 }, outputs )
@@ -1215,7 +1234,7 @@ func TestInvalidAsset(t *testing.T) {
12151234 }
12161235 inputs , assets , err := makeTerraformInputsNoDefaults (olds , props , tfs , ps )
12171236 assert .NoError (t , err )
1218- outputs := MakeTerraformOutputs (ctx , shimv1 .NewProvider (testTFProvider ), inputs , tfs , ps , assets , false , true )
1237+ outputs := MakeTerraformOutputs (ctx , shimv1 .NewProvider (testTFProvider ), inputs , tfs , ps , assets , true )
12191238 assert .Equal (t , resource.PropertyMap {
12201239 "zzz" : resource .NewStringProperty ("invalid" ),
12211240 }, outputs )
@@ -1280,8 +1299,7 @@ func TestOverridingTFSchema(t *testing.T) {
12801299 tfInputs ,
12811300 tfSchema ,
12821301 typeOverrides ,
1283- nil , /* assets */
1284- false , /*useRawNames*/
1302+ nil , /* assets */
12851303 true ,
12861304 )
12871305 assert .Equal (t , tfOutputs , result )
@@ -1332,7 +1350,7 @@ func TestArchiveAsAsset(t *testing.T) {
13321350 }
13331351 inputs , assets , err := makeTerraformInputsNoDefaults (olds , props , tfs , ps )
13341352 assert .NoError (t , err )
1335- outputs := MakeTerraformOutputs (ctx , shimv1 .NewProvider (testTFProvider ), inputs , tfs , ps , assets , false , true )
1353+ outputs := MakeTerraformOutputs (ctx , shimv1 .NewProvider (testTFProvider ), inputs , tfs , ps , assets , true )
13361354 assert .True (t , arch .DeepEquals (outputs ["zzz" ]))
13371355}
13381356
@@ -1701,8 +1719,7 @@ func TestStringOutputsWithSchema(t *testing.T) {
17011719 "not_a_float_value" : {Type : schemav1 .TypeFloat },
17021720 }),
17031721 map [string ]* SchemaInfo {},
1704- nil , /* assets */
1705- false , /* useRawNames */
1722+ nil , /* assets */
17061723 true ,
17071724 )
17081725
@@ -2760,7 +2777,6 @@ func TestOutputNumberTypes(t *testing.T) {
27602777 tfs ,
27612778 map [string ]* SchemaInfo {},
27622779 AssetTable {},
2763- false ,
27642780 true ,
27652781 )
27662782 assert .Equal (t , resource.PropertyMap {
0 commit comments