@@ -9,6 +9,7 @@ package recipe
9
9
10
10
import (
11
11
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
12
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
12
13
13
14
"github.com/vmware/terraform-provider-tanzu-mission-control/internal/helper"
14
15
policyrecipecustommodel "github.com/vmware/terraform-provider-tanzu-mission-control/internal/models/policy/recipe/custom"
@@ -43,9 +44,10 @@ var TMCBlockRolebindingSubjects = &schema.Schema{
43
44
Elem : & schema.Resource {
44
45
Schema : map [string ]* schema.Schema {
45
46
kindKey : {
46
- Type : schema .TypeString ,
47
- Description : "The kind of subject to disallow, can be User/Group/ServiceAccount." ,
48
- Required : true ,
47
+ Type : schema .TypeString ,
48
+ Description : "The kind of subject to disallow, can be User/Group/ServiceAccount." ,
49
+ Required : true ,
50
+ ValidateFunc : validation .StringInSlice ([]string {"User" , "Group" , "ServiceAccount" }, false ),
49
51
},
50
52
nameKey : {
51
53
Type : schema .TypeString ,
@@ -136,11 +138,11 @@ func expandDisallowedSubjects(data interface{}) (disallowedSubjects *policyrecip
136
138
137
139
disallowedSubjects = & policyrecipecustommodel.VmwareTanzuManageV1alpha1CommonPolicySpecCustomV1TMCBlockRoleBindingSubjectsParametersDisallowedSubjects {}
138
140
139
- if v , ok := disallowedSubjectsData [labelKey ]; ok {
141
+ if v , ok := disallowedSubjectsData [kindKey ]; ok {
140
142
helper .SetPrimitiveValue (v , & disallowedSubjects .Kind , kindKey )
141
143
}
142
144
143
- if v , ok := disallowedSubjectsData [labelValueKey ]; ok {
145
+ if v , ok := disallowedSubjectsData [nameKey ]; ok {
144
146
helper .SetPrimitiveValue (v , & disallowedSubjects .Name , nameKey )
145
147
}
146
148
0 commit comments