diff --git a/docs/resources/dynamic_group.md b/docs/resources/dynamic_group.md index 6ca7832..d1b27b5 100644 --- a/docs/resources/dynamic_group.md +++ b/docs/resources/dynamic_group.md @@ -23,7 +23,7 @@ Dynamic Group resource manages Google Workspace Groups with Dynamic memberships. ### Optional - `description` (String) An extended description to help users determine the purpose of a group.For example, you can include information about who should join the group,the types of messages to send to the group, links to FAQs about the group, or related groups. -- `labels` (Map of String) Defaults to `map[cloudidentity.googleapis.com/groups.discussion_forum:]`. One or more label entries that apply to the Group. Currently supported labels contain a key with an empty value. +- `labels` (Map of String) One or more label entries that apply to the Group. Currently supported labels contain a key with an empty value. - `name` (String) The group's display name. - `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts)) diff --git a/internal/provider/resource_dynamic_group.go b/internal/provider/resource_dynamic_group.go index ac55b52..32b74ca 100644 --- a/internal/provider/resource_dynamic_group.go +++ b/internal/provider/resource_dynamic_group.go @@ -98,7 +98,6 @@ func resourceDynamicGroup() *schema.Resource { Type: schema.TypeMap, Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, - Default: map[string]interface{}{"cloudidentity.googleapis.com/groups.discussion_forum": ""}, }, }, } @@ -123,9 +122,16 @@ func resourceDynamicGroupCreate(ctx context.Context, d *schema.ResourceData, met return diags } - labels, err := convertInterfaceMapToStringMap(d.Get("labels").(map[string]interface{})) - if err != nil { - return diag.FromErr(err) + labelsRaw, ok := d.GetOk("labels") + var labels map[string]string + if !ok || len(labelsRaw.(map[string]interface{})) == 0 { + labels = map[string]string{"cloudidentity.googleapis.com/groups.discussion_forum": ""} + } else { + var err error + labels, err = convertInterfaceMapToStringMap(labelsRaw.(map[string]interface{})) + if err != nil { + return diag.FromErr(err) + } } groupObj := cloudidentity.Group{