Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add users datasource #79

Merged
merged 13 commits into from
Feb 1, 2019
Merged

Conversation

jorcau
Copy link
Collaborator

@jorcau jorcau commented Jan 18, 2019

Add new gitlab_users datasource that returns a list of users.

It takes optional arguments such as order_by, sort and search, full list in the included documentation.

Examples:

  • Get all users
data "gitlab_users" "all_users" {
}
  • Get users created before the 5th of April 2018 ordered by username in ascendant order
data "gitlab_users" "username" {
    order_by = "username"
    sort = "asc"
    created_before = "2018-04-05"
}

gitlab/data_source_gitlab_users.go Outdated Show resolved Hide resolved
website/docs/d/users.html.markdown Outdated Show resolved Hide resolved
website/docs/d/users.html.markdown Show resolved Hide resolved
website/docs/d/users.html.markdown Show resolved Hide resolved
website/docs/d/users.html.markdown Show resolved Hide resolved
website/docs/d/users.html.markdown Outdated Show resolved Hide resolved
website/docs/d/users.html.markdown Show resolved Hide resolved
* `created_at` - Date the user was created at.
* `state` - Whether the user is active or blocked.
* `external` - Whether the user is external.
* `extern_uid` - The external UID of the user.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot the extern_provider field be also exposed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were actually a lot of missing properties. I added them all, including extern_provider that is named provider to match the API.

@jorcau jorcau force-pushed the add_users_datasource branch from eb28bd0 to 5e577ef Compare January 22, 2019 12:25
Copy link
Contributor

@pdecat pdecat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some formatting nitpicks.

image

website/docs/d/users.html.markdown Outdated Show resolved Hide resolved
website/docs/d/users.html.markdown Outdated Show resolved Hide resolved
website/docs/d/users.html.markdown Outdated Show resolved Hide resolved
website/docs/d/users.html.markdown Outdated Show resolved Hide resolved
website/docs/d/users.html.markdown Outdated Show resolved Hide resolved
website/docs/d/users.html.markdown Outdated Show resolved Hide resolved
website/docs/d/users.html.markdown Outdated Show resolved Hide resolved
website/docs/d/users.html.markdown Outdated Show resolved Hide resolved
website/docs/d/users.html.markdown Outdated Show resolved Hide resolved
@jorcau jorcau force-pushed the add_users_datasource branch from 5e577ef to dcd508e Compare January 22, 2019 15:51
@jorcau
Copy link
Collaborator Author

jorcau commented Jan 22, 2019

Some formatting nitpicks.

Thanks for reviewing @pdecat! Didn't see there were tabs instead of spaces :)

Copy link
Contributor

@pdecat pdecat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

What about acceptance tests results?

@jorcau
Copy link
Collaborator Author

jorcau commented Feb 1, 2019

Thanks @pdecat! Here's the acceptance test result:

➜ make testacc TEST=./gitlab TESTARGS='-run=TestAccDataSourceGitlabUsers_*'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./gitlab -v -run=TestAccDataSourceGitlabUsers_* -timeout 120m
=== RUN   TestAccDataSourceGitlabUsers_basic
--- PASS: TestAccDataSourceGitlabUsers_basic (3.52s)
PASS
ok  	github.com/terraform-providers/terraform-provider-gitlab/gitlab	3.543s

@roidelapluie roidelapluie merged commit facacb5 into gitlabhq:master Feb 1, 2019
@roidelapluie
Copy link
Collaborator

Thanks!!

@github-actions github-actions bot locked and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

3 participants