Skip to content

Commit

Permalink
Added check for exact group name match on group data source.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Bartlett committed Jul 16, 2020
1 parent 33c6f33 commit f7fd54d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions okta/data_source_okta_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ func findGroup(name string, d *schema.ResourceData, m interface{}) error {
return fmt.Errorf("failed to query for groups: %v", err)
} else if len(groups) < 1 {
return errors.New("Group not found")
} else if len(groups) > 1 {
fmt.Println("Found multiple groups with the supplied parameters. Using the first one which may only be a partial match.")
} else if len(groups[0].Profile.Name) != len(name) {
fmt.Println("Group with exact match to the supplied name not found. Using partial match which contains name as a substring.")
}

d.SetId(groups[0].Id)
Expand Down

0 comments on commit f7fd54d

Please sign in to comment.