data source GitLab User: return exact matching user if attributes match

When we use the data source gitlab_user we run into the issue that the exact searched user is not returned if multiple user match the search.

Given: two existing users with email:

  • a.lastname@example.com
  • aaa.lastname@example.com

using the resource gitlab_user like this:

data "gitlab_user" "a.lastname" {
    email = "a.lastname@example.com"
}

will result in an info message:

more than one user found matching. Will return the first user, since this can only happen when using search

This change will enable the data source to return the desired user as there is an exact match for the provided email attribute without issuing unnecessary info messages.

Edited by Ricardo Bartels

Merge request reports

Loading