Skip to content
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

1073 add organization setting to realm #1076

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sschu
Copy link
Contributor

@sschu sschu commented Jan 15, 2025

Closes #1073

Signed-off-by: Sebastian Schuster <[email protected]>
Copy link
Contributor

@thomasdarimont thomasdarimont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR. I'd instead use organizations_enabled rather than just organizations. This explains the intent more clearly.

We also should exclude the attribute in tests <= KC24 .

@@ -29,6 +29,7 @@ type Realm struct {
DisplayName string `json:"displayName"`
DisplayNameHtml string `json:"displayNameHtml"`
UserManagedAccess bool `json:"userManagedAccessAllowed"`
Organizations bool `json:"organizationsEnabled"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Organizations bool `json:"organizationsEnabled"`
OrganizationsEnabled bool `json:"organizationsEnabled"`

@@ -116,6 +116,10 @@ func dataSourceKeycloakRealm() *schema.Resource {
Type: schema.TypeBool,
Computed: true,
},
"organizations": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"organizations": {
"organizations_enabled": {

@@ -179,6 +179,11 @@ func resourceKeycloakRealm() *schema.Resource {
Optional: true,
Default: false,
},
"organizations": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"organizations": {
"organizations_enabled": {

@@ -745,6 +750,7 @@ func getRealmFromData(data *schema.ResourceData) (*keycloak.Realm, error) {
DisplayName: data.Get("display_name").(string),
DisplayNameHtml: data.Get("display_name_html").(string),
UserManagedAccess: data.Get("user_managed_access").(bool),
Organizations: data.Get("organizations").(bool),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Organizations: data.Get("organizations").(bool),
OrganizationsEnabled: data.Get("organizations_enabled").(bool),

@@ -1179,6 +1185,7 @@ func setRealmData(data *schema.ResourceData, realm *keycloak.Realm) {
data.Set("display_name", realm.DisplayName)
data.Set("display_name_html", realm.DisplayNameHtml)
data.Set("user_managed_access", realm.UserManagedAccess)
data.Set("organizations", realm.Organizations)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
data.Set("organizations", realm.Organizations)
data.Set("organizations_enabled", realm.OrganizationsEnabled)

@@ -83,6 +83,7 @@ resource "keycloak_realm" "realm" {
- `display_name` - (Optional) The display name for the realm that is shown when logging in to the admin console.
- `display_name_html` - (Optional) The display name for the realm that is rendered as HTML on the screen when logging in to the admin console.
- `user_managed_access` - (Optional) When `true`, users are allowed to manage their own resources. Defaults to `false`.
- `organizations` - (Optional) When `true`, organization support is enabled. Defaults to `false`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `organizations` - (Optional) When `true`, organization support is enabled. Defaults to `false`.
- `organizations_enabled` - (Optional) When `true`, organization support is enabled. Defaults to `false`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot enable keycloak organizations on an existing realm
2 participants