Skip to content

Commit

Permalink
Auth Division Data returns exact Lookup Match
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianMoyles committed Jan 29, 2024
1 parent e42577e commit 49ecdc3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions genesyscloud/data_source_genesyscloud_auth_division.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ func dataSourceAuthDivisionRead(ctx context.Context, d *schema.ResourceData, m i
return retry.RetryableError(fmt.Errorf("No authorization divisions found with name %s", name))
}

division := (*divisions.Entities)[0]
d.SetId(*division.Id)
return nil
for _, division := range *divisions.Entities {
if *division.Name == name {
d.SetId(*division.Id)
return nil
}
}

return retry.RetryableError(fmt.Errorf("No division with name %s found", name))
})
}

0 comments on commit 49ecdc3

Please sign in to comment.