Skip to content

Commit 8a25360

Browse files
committed
fix: keep existing realm attributes on apply
1 parent f87470c commit 8a25360

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

provider/resource_keycloak_realm.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,9 +1327,11 @@ func setRealmData(data *schema.ResourceData, realm *keycloak.Realm) {
13271327
webAuthnPasswordlessPolicy["user_verification_requirement"] = realm.WebAuthnPolicyPasswordlessUserVerificationRequirement
13281328
data.Set("web_authn_passwordless_policy", []interface{}{webAuthnPasswordlessPolicy})
13291329

1330-
attributes := map[string]interface{}{}
1330+
var attributes map[string]interface{}{}
13311331
if v, ok := data.GetOk("attributes"); ok {
1332-
for key := range v.(map[string]interface{}) {
1332+
existingAttributes := v.(map[string]interface{})
1333+
attributes = existingAttributes
1334+
for key := range existingAttributes {
13331335
attributes[key] = realm.Attributes[key]
13341336
//We are only interested in attributes managed in terraform (Keycloak returns a lot of doubles values in the attributes...)
13351337
}

0 commit comments

Comments
 (0)