File tree Expand file tree Collapse file tree 4 files changed +17
-0
lines changed Expand file tree Collapse file tree 4 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ resource "keycloak_realm_user_profile" "userprofile" {
2828 display_name = "Field 1"
2929 group = "group1"
3030
31+ multi_valued = false
3132 enabled_when_scope = ["offline_access"]
3233
3334 required_for_roles = ["user"]
@@ -98,6 +99,7 @@ resource "keycloak_realm_user_profile" "userprofile" {
9899
99100- ` name ` - (Required) The name of the attribute.
100101- ` display_name ` - (Optional) The display name of the attribute.
102+ - ` multi_valued ` - (Optional) If the attribute supports multiple values. Defaults to ` false ` .
101103- ` group ` - (Optional) The group that the attribute belong to.
102104- ` enabled_when_scope ` - (Optional) A list of scopes. The attribute will only be enabled when these scopes are requested by clients.
103105- ` required_for_roles ` - (Optional) A list of roles for which the attribute will be required.
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ type RealmUserProfileAttribute struct {
2727 DisplayName string `json:"displayName,omitempty"`
2828 Group string `json:"group,omitempty"`
2929 Name string `json:"name"`
30+ MultiValued bool `json:"multivalued,omitempty"`
3031 Permissions * RealmUserProfilePermissions `json:"permissions,omitempty"`
3132 Required * RealmUserProfileRequired `json:"required,omitempty"`
3233 Selector * RealmUserProfileSelector `json:"selector,omitempty"`
Original file line number Diff line number Diff line change @@ -46,6 +46,11 @@ func resourceKeycloakRealmUserProfile() *schema.Resource {
4646 Type : schema .TypeString ,
4747 Optional : true ,
4848 },
49+ "multi_valued" : {
50+ Type : schema .TypeBool ,
51+ Optional : true ,
52+ Default : false ,
53+ },
4954 "group" : {
5055 Type : schema .TypeString ,
5156 Optional : true ,
@@ -153,6 +158,12 @@ func getRealmUserProfileAttributeFromData(m map[string]interface{}) *keycloak.Re
153158 Group : m ["group" ].(string ),
154159 }
155160
161+ if v , ok := m ["multivalued" ].(bool ); ok {
162+ attribute .MultiValued = v
163+ } else {
164+ attribute .MultiValued = false
165+ }
166+
156167 if v , ok := m ["permissions" ]; ok && len (v .([]interface {})) > 0 {
157168 permissions := keycloak.RealmUserProfilePermissions {
158169 Edit : make ([]string , 0 ),
@@ -329,6 +340,8 @@ func getRealmUserProfileAttributeData(attr *keycloak.RealmUserProfileAttribute)
329340 attributeData ["name" ] = attr .Name
330341
331342 attributeData ["display_name" ] = attr .DisplayName
343+ attributeData ["multi_valued" ] = attr .MultiValued
344+
332345 attributeData ["group" ] = attr .Group
333346 if attr .Selector != nil && len (attr .Selector .Scopes ) != 0 {
334347 attributeData ["enabled_when_scope" ] = attr .Selector .Scopes
Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ func TestAccKeycloakRealmUserProfile_basicFull(t *testing.T) {
106106 {
107107 Name : "attribute2" ,
108108 DisplayName : "attribute 2" ,
109+ MultiValued : false ,
109110 Group : "group" ,
110111 Selector : & keycloak.RealmUserProfileSelector {Scopes : []string {"roles" }},
111112 Required : & keycloak.RealmUserProfileRequired {
You can’t perform that action at this time.
0 commit comments