diff --git a/docs/resources/organization.md b/docs/resources/organization.md index 6bbcbc472..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` - (Required) 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 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{}