@@ -917,104 +917,103 @@ func TestSchemaProposeNewState(t *testing.T) {
917917 ),
918918 },
919919 },
920- // TODO: uncomment after implementing map logic
921- //"prior nested map": {
922- // schema: schema.Schema{
923- // Attributes: map[string]schema.Attribute{
924- // "map_nested_attribute": schema.MapNestedAttribute{
925- // Optional: true,
926- // NestedObject: schema.NestedAttributeObject{
927- // Attributes: map[string]schema.Attribute{
928- // "required_nested_attribute": schema.StringAttribute{
929- // Required: true,
930- // },
931- // },
932- // },
933- // },
934- // },
935- // },
936- // priorVal: map[string]tftypes.Value{
937- // "map_nested_attribute": tftypes.NewValue(
938- // tftypes.Map{
939- // ElementType: tftypes.Object{
940- // AttributeTypes: map[string]tftypes.Type{
941- // "required_nested_attribute": tftypes.String,
942- // },
943- // },
944- // },
945- // map[string]tftypes.Value{
946- // "a": tftypes.NewValue(tftypes.Object{
947- // AttributeTypes: map[string]tftypes.Type{
948- // "required_nested_attribute": tftypes.String,
949- // },
950- // }, map[string]tftypes.Value{
951- // "required_nested_attribute": tftypes.NewValue(tftypes.String, "glub"),
952- // }),
953- // "b": tftypes.NewValue(tftypes.Object{
954- // AttributeTypes: map[string]tftypes.Type{
955- // "required_nested_attribute": tftypes.String,
956- // },
957- // }, map[string]tftypes.Value{
958- // "required_nested_attribute": tftypes.NewValue(tftypes.String, "blub"),
959- // }),
960- // },
961- // ),
962- // },
963- // configVal: map[string]tftypes.Value{
964- // "map_nested_attribute": tftypes.NewValue(
965- // tftypes.Map{
966- // ElementType: tftypes.Object{
967- // AttributeTypes: map[string]tftypes.Type{
968- // "required_nested_attribute": tftypes.String,
969- // },
970- // },
971- // },
972- // map[string]tftypes.Value{
973- // "a": tftypes.NewValue(tftypes.Object{
974- // AttributeTypes: map[string]tftypes.Type{
975- // "required_nested_attribute": tftypes.String,
976- // },
977- // }, map[string]tftypes.Value{
978- // "required_nested_attribute": tftypes.NewValue(tftypes.String, "glub"),
979- // }),
980- // "c": tftypes.NewValue(tftypes.Object{
981- // AttributeTypes: map[string]tftypes.Type{
982- // "required_nested_attribute": tftypes.String,
983- // },
984- // }, map[string]tftypes.Value{
985- // "required_nested_attribute": tftypes.NewValue(tftypes.String, "blub"),
986- // }),
987- // },
988- // ),
989- // },
990- // expectedVal: map[string]tftypes.Value{
991- // "map_nested_attribute": tftypes.NewValue(
992- // tftypes.Map{
993- // ElementType: tftypes.Object{
994- // AttributeTypes: map[string]tftypes.Type{
995- // "required_nested_attribute": tftypes.String,
996- // },
997- // },
998- // },
999- // map[string]tftypes.Value{
1000- // "a": tftypes.NewValue(tftypes.Object{
1001- // AttributeTypes: map[string]tftypes.Type{
1002- // "required_nested_attribute": tftypes.String,
1003- // },
1004- // }, map[string]tftypes.Value{
1005- // "required_nested_attribute": tftypes.NewValue(tftypes.String, "glub"),
1006- // }),
1007- // "c": tftypes.NewValue(tftypes.Object{
1008- // AttributeTypes: map[string]tftypes.Type{
1009- // "required_nested_attribute": tftypes.String,
1010- // },
1011- // }, map[string]tftypes.Value{
1012- // "required_nested_attribute": tftypes.NewValue(tftypes.String, "blub"),
1013- // }),
1014- // },
1015- // ),
1016- // },
1017- //},
920+ "prior nested map" : {
921+ schema : schema.Schema {
922+ Attributes : map [string ]schema.Attribute {
923+ "map_nested_attribute" : schema.MapNestedAttribute {
924+ Optional : true ,
925+ NestedObject : schema.NestedAttributeObject {
926+ Attributes : map [string ]schema.Attribute {
927+ "required_nested_attribute" : schema.StringAttribute {
928+ Required : true ,
929+ },
930+ },
931+ },
932+ },
933+ },
934+ },
935+ priorVal : map [string ]tftypes.Value {
936+ "map_nested_attribute" : tftypes .NewValue (
937+ tftypes.Map {
938+ ElementType : tftypes.Object {
939+ AttributeTypes : map [string ]tftypes.Type {
940+ "required_nested_attribute" : tftypes .String ,
941+ },
942+ },
943+ },
944+ map [string ]tftypes.Value {
945+ "a" : tftypes .NewValue (tftypes.Object {
946+ AttributeTypes : map [string ]tftypes.Type {
947+ "required_nested_attribute" : tftypes .String ,
948+ },
949+ }, map [string ]tftypes.Value {
950+ "required_nested_attribute" : tftypes .NewValue (tftypes .String , "glub" ),
951+ }),
952+ "b" : tftypes .NewValue (tftypes.Object {
953+ AttributeTypes : map [string ]tftypes.Type {
954+ "required_nested_attribute" : tftypes .String ,
955+ },
956+ }, map [string ]tftypes.Value {
957+ "required_nested_attribute" : tftypes .NewValue (tftypes .String , "blub" ),
958+ }),
959+ },
960+ ),
961+ },
962+ configVal : map [string ]tftypes.Value {
963+ "map_nested_attribute" : tftypes .NewValue (
964+ tftypes.Map {
965+ ElementType : tftypes.Object {
966+ AttributeTypes : map [string ]tftypes.Type {
967+ "required_nested_attribute" : tftypes .String ,
968+ },
969+ },
970+ },
971+ map [string ]tftypes.Value {
972+ "a" : tftypes .NewValue (tftypes.Object {
973+ AttributeTypes : map [string ]tftypes.Type {
974+ "required_nested_attribute" : tftypes .String ,
975+ },
976+ }, map [string ]tftypes.Value {
977+ "required_nested_attribute" : tftypes .NewValue (tftypes .String , "glub" ),
978+ }),
979+ "c" : tftypes .NewValue (tftypes.Object {
980+ AttributeTypes : map [string ]tftypes.Type {
981+ "required_nested_attribute" : tftypes .String ,
982+ },
983+ }, map [string ]tftypes.Value {
984+ "required_nested_attribute" : tftypes .NewValue (tftypes .String , "blub" ),
985+ }),
986+ },
987+ ),
988+ },
989+ expectedVal : map [string ]tftypes.Value {
990+ "map_nested_attribute" : tftypes .NewValue (
991+ tftypes.Map {
992+ ElementType : tftypes.Object {
993+ AttributeTypes : map [string ]tftypes.Type {
994+ "required_nested_attribute" : tftypes .String ,
995+ },
996+ },
997+ },
998+ map [string ]tftypes.Value {
999+ "a" : tftypes .NewValue (tftypes.Object {
1000+ AttributeTypes : map [string ]tftypes.Type {
1001+ "required_nested_attribute" : tftypes .String ,
1002+ },
1003+ }, map [string ]tftypes.Value {
1004+ "required_nested_attribute" : tftypes .NewValue (tftypes .String , "glub" ),
1005+ }),
1006+ "c" : tftypes .NewValue (tftypes.Object {
1007+ AttributeTypes : map [string ]tftypes.Type {
1008+ "required_nested_attribute" : tftypes .String ,
1009+ },
1010+ }, map [string ]tftypes.Value {
1011+ "required_nested_attribute" : tftypes .NewValue (tftypes .String , "blub" ),
1012+ }),
1013+ },
1014+ ),
1015+ },
1016+ },
10181017 "prior optional computed nested map elem to null" : {
10191018 schema : schema.Schema {
10201019 Attributes : map [string ]schema.Attribute {
0 commit comments