You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to add new user profile attributes using the keycloak_realm_user_profile resource in Terraform, the provider attempts to update or remove default attributes (username, email, etc.), which causes a 400 Bad Request error from Keycloak.
Error: error sending PUT request to /admin/realms/XXX/users/profile: 400 Bad Request. Response body: {"errorMessage":"[The attribute 'username' can not be removed, The attribute 'email' can not be removed]"}
Version
26.0.7 Keycloak & 4.5 terraform provider
Expected behavior
The provider should only add or update the attributes explicitly mentioned in the Terraform configuration, without attempting to modify or remove default attributes (username, email, etc.) that are pre-defined in Keycloak.
Actual behavior
The provider replaces the entire set of user profile attributes during a PUT operation, leading to a 400 error when default attributes are unintentionally removed.
How to Reproduce?
Use a Keycloak instance with default user profile attributes (e.g., username, email, firstName, lastName).
Define a keycloak_realm_user_profile resource in Terraform with additional attributes but without mentioning the default ones.
Describe the bug
When attempting to add new user profile attributes using the keycloak_realm_user_profile resource in Terraform, the provider attempts to update or remove default attributes (username, email, etc.), which causes a 400 Bad Request error from Keycloak.
Error: error sending PUT request to /admin/realms/XXX/users/profile: 400 Bad Request. Response body: {"errorMessage":"[The attribute 'username' can not be removed, The attribute 'email' can not be removed]"}
Version
26.0.7 Keycloak & 4.5 terraform provider
Expected behavior
The provider should only add or update the attributes explicitly mentioned in the Terraform configuration, without attempting to modify or remove default attributes (username, email, etc.) that are pre-defined in Keycloak.
Actual behavior
The provider replaces the entire set of user profile attributes during a PUT operation, leading to a 400 error when default attributes are unintentionally removed.
How to Reproduce?
resource "keycloak_realm" "realm" {
realm = "my-realm"
attributes = {
userProfileEnabled = true
}
}
resource "keycloak_realm_user_profile" "userprofile" {
realm_id = keycloak_realm.my_realm.id
attribute {
name = "field1"
display_name = "Field 1"
group = "group1"
}
attribute {
name = "field2"
}
group {
name = "group1"
display_header = "Group 1"
display_description = "A first group"
}
group {
name = "group2"
}
}
Anything else?
No response
The text was updated successfully, but these errors were encountered: