Skip to content

Commit

Permalink
fix: keep existing realm attributes on apply
Browse files Browse the repository at this point in the history
Signed-off-by: Ados <[email protected]>
  • Loading branch information
AdosH1 committed Dec 12, 2024
1 parent f87470c commit 1861e79
Showing 1 changed file with 4 additions and 2 deletions.
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{}{}

Check failure on line 1330 in provider/resource_keycloak_realm.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

syntax error: unexpected { at end of statement

Check failure on line 1330 in provider/resource_keycloak_realm.go

View workflow job for this annotation

GitHub Actions / verify

syntax error: unexpected { at end of statement
if v, ok := data.GetOk("attributes"); ok {

Check failure on line 1331 in provider/resource_keycloak_realm.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

syntax error: non-declaration statement outside function body

Check failure on line 1331 in provider/resource_keycloak_realm.go

View workflow job for this annotation

GitHub Actions / verify

syntax error: non-declaration statement outside function body
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

0 comments on commit 1861e79

Please sign in to comment.