From 77508efcf0dcc0a142ac70e1890c1c4e0a631922 Mon Sep 17 00:00:00 2001 From: Tuan Kiet Truong Date: Tue, 25 Nov 2025 11:00:22 +0100 Subject: [PATCH 1/2] feat: make organization domain field optional Signed-off-by: Tuan Kiet Truong --- docs/resources/organization.md | 2 +- provider/resource_keycloak_organization.go | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/resources/organization.md b/docs/resources/organization.md index 6bbcbc472..a930f242c 100644 --- a/docs/resources/organization.md +++ b/docs/resources/organization.md @@ -51,7 +51,7 @@ resource "keycloak_oidc_identity_provider" "this" { - `alias` - (Optional) The alias unique identifies the organization. Same as the name if not specified. The alias cannot be changed after the organization has been created. - `description` - (Optional) The description of the organization. - `redirect_url` - (Optional) The landing page after user completes registration or accepts an invitation to the organization. If left empty, the user will be redirected to the account console by default. -- `domain` - (Required) A list of [domains](#domain-arguments). At least one domain is required. +- `domain` - (Optional) A list of [domains](#domain-arguments). At least one domain is required. - `attributes` - (Optional) A map representing attributes for the group. In order to add multivalued attributes, use `##` to separate the values. Max length for each value is 255 chars. ### Domain arguments diff --git a/provider/resource_keycloak_organization.go b/provider/resource_keycloak_organization.go index 1c3c8e3f4..f1aa57dd1 100644 --- a/provider/resource_keycloak_organization.go +++ b/provider/resource_keycloak_organization.go @@ -56,8 +56,8 @@ func resourceKeycloakOrganization() *schema.Resource { }, "domain": { Type: schema.TypeSet, - Required: true, - MinItems: 1, + Optional: true, + MinItems: 0, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { @@ -104,9 +104,6 @@ func getOrganizationFromData(data *schema.ResourceData) (*keycloak.Organization, } } - if len(domains) == 0 { - return nil, fmt.Errorf("at least one domain is required") - } organization.Domains = domains attributes := map[string][]string{} From e9b38b6b5dd48e3ccef9065de64e1b3a870868ba Mon Sep 17 00:00:00 2001 From: Tuan Kiet Truong Date: Wed, 26 Nov 2025 10:18:04 +0100 Subject: [PATCH 2/2] fix: adjust docs Signed-off-by: Tuan Kiet Truong --- docs/resources/organization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/resources/organization.md b/docs/resources/organization.md index a930f242c..44ea3e28b 100644 --- a/docs/resources/organization.md +++ b/docs/resources/organization.md @@ -51,7 +51,7 @@ resource "keycloak_oidc_identity_provider" "this" { - `alias` - (Optional) The alias unique identifies the organization. Same as the name if not specified. The alias cannot be changed after the organization has been created. - `description` - (Optional) The description of the organization. - `redirect_url` - (Optional) The landing page after user completes registration or accepts an invitation to the organization. If left empty, the user will be redirected to the account console by default. -- `domain` - (Optional) A list of [domains](#domain-arguments). At least one domain is required. +- `domain` - (Optional) A list of [domains](#domain-arguments). - `attributes` - (Optional) A map representing attributes for the group. In order to add multivalued attributes, use `##` to separate the values. Max length for each value is 255 chars. ### Domain arguments