diff --git a/okta/data_source_okta_group.go b/okta/data_source_okta_group.go index c720b3acc..1be17c4e3 100644 --- a/okta/data_source_okta_group.go +++ b/okta/data_source_okta_group.go @@ -63,6 +63,10 @@ func findGroup(ctx context.Context, name string, d *schema.ResourceData, m inter return diag.Errorf("group with name '%s' and type '%s' does not exist", name, d.Get("type").(string)) } return diag.Errorf("group with name '%s' does not exist", name) + } else if len(groups) > 1 { + logger(m).Warn("Found multiple groups with the supplied parameters: using the first one which may only be a partial match", "name", groups[0].Profile.Name) + } else if len(groups[0].Profile.Name) != len(name) { + logger(m).Warn("The group with an exact match to the supplied name was not found: using partial match which contains name as a substring", "name", groups[0].Profile.Name) } d.SetId(groups[0].Id) _ = d.Set("description", groups[0].Profile.Description)