Skip to content

fix: keep existing realm attributes on apply #1030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions provider/resource_keycloak_realm.go
Original file line number Diff line number Diff line change
Expand Up @@ -1327,9 +1327,11 @@ func setRealmData(data *schema.ResourceData, realm *keycloak.Realm) {
webAuthnPasswordlessPolicy["user_verification_requirement"] = realm.WebAuthnPolicyPasswordlessUserVerificationRequirement
data.Set("web_authn_passwordless_policy", []interface{}{webAuthnPasswordlessPolicy})

attributes := map[string]interface{}{}
var attributes map[string]interface{}
if v, ok := data.GetOk("attributes"); ok {
for key := range v.(map[string]interface{}) {
existingAttributes := v.(map[string]interface{})
attributes = existingAttributes
for key := range existingAttributes {
attributes[key] = realm.Attributes[key]
//We are only interested in attributes managed in terraform (Keycloak returns a lot of doubles values in the attributes...)
}
Expand Down
Loading