@@ -6841,7 +6841,7 @@ func TestSchemaSet_ValidateMaxItems(t *testing.T) {
68416841 Diff : nil ,
68426842 Err : true ,
68436843 Errors : []error {
6844- fmt .Errorf ("Error: Too many list items: Attribute supports 1 item maximum, but config has 2 declared." ),
6844+ fmt .Errorf ("Error: Too many list items: Attribute aliases supports 1 item maximum, but config has 2 declared." ),
68456845 },
68466846 },
68476847 "#1" : {
@@ -6877,6 +6877,40 @@ func TestSchemaSet_ValidateMaxItems(t *testing.T) {
68776877 Err : false ,
68786878 Errors : nil ,
68796879 },
6880+ "#3" : {
6881+ Schema : map [string ]* Schema {
6882+ "service_account" : {
6883+ Type : TypeList ,
6884+ Optional : true ,
6885+ ForceNew : true ,
6886+ Elem : & Resource {
6887+ Schema : map [string ]* Schema {
6888+ "aliases" : {
6889+ Type : TypeSet ,
6890+ Optional : true ,
6891+ MinItems : 2 ,
6892+ Elem : & Schema {Type : TypeString },
6893+ },
6894+ },
6895+ },
6896+ },
6897+ },
6898+
6899+ State : nil ,
6900+
6901+ Config : map [string ]interface {}{
6902+ "service_account" : []interface {}{
6903+ map [string ]interface {}{
6904+ "aliases" : []interface {}{"foo" },
6905+ },
6906+ },
6907+ },
6908+ Diff : nil ,
6909+ Err : true ,
6910+ Errors : []error {
6911+ fmt .Errorf ("Error: Not enough list items: Attribute service_account.0.aliases requires 2 item minimum, but config has only 1 declared." ),
6912+ },
6913+ },
68806914 }
68816915
68826916 for tn , tc := range cases {
@@ -6963,7 +6997,41 @@ func TestSchemaSet_ValidateMinItems(t *testing.T) {
69636997 Diff : nil ,
69646998 Err : true ,
69656999 Errors : []error {
6966- fmt .Errorf ("Error: Not enough list items: Attribute requires 2 item minimum, but config has only 1 declared." ),
7000+ fmt .Errorf ("Error: Not enough list items: Attribute aliases requires 2 item minimum, but config has only 1 declared." ),
7001+ },
7002+ },
7003+ "#3" : {
7004+ Schema : map [string ]* Schema {
7005+ "service_account" : {
7006+ Type : TypeList ,
7007+ Optional : true ,
7008+ ForceNew : true ,
7009+ Elem : & Resource {
7010+ Schema : map [string ]* Schema {
7011+ "aliases" : {
7012+ Type : TypeSet ,
7013+ Optional : true ,
7014+ MinItems : 2 ,
7015+ Elem : & Schema {Type : TypeString },
7016+ },
7017+ },
7018+ },
7019+ },
7020+ },
7021+
7022+ State : nil ,
7023+
7024+ Config : map [string ]interface {}{
7025+ "service_account" : []interface {}{
7026+ map [string ]interface {}{
7027+ "aliases" : []interface {}{"foo" },
7028+ },
7029+ },
7030+ },
7031+ Diff : nil ,
7032+ Err : true ,
7033+ Errors : []error {
7034+ fmt .Errorf ("Error: Not enough list items: Attribute service_account.0.aliases requires 2 item minimum, but config has only 1 declared." ),
69677035 },
69687036 },
69697037 }
0 commit comments