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

Feature Request: datasource all_users_datasource.go #512

Closed
Threpio opened this issue Aug 10, 2021 · 6 comments · Fixed by #513
Closed

Feature Request: datasource all_users_datasource.go #512

Threpio opened this issue Aug 10, 2021 · 6 comments · Fixed by #513

Comments

@Threpio
Copy link
Contributor

Threpio commented Aug 10, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritise this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritise the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

For work I am currently treating our AAD setup as the single source of truth for the user base/permissions and group ownership. I would like to be able to fetch all of the users in the AAD to utilise the permissions already defined when I create other non AAD setup users (for example: Pagerduty).

I would like for there to be a datasource list of users that can be iterated through to include their basic information such as userPrincipleName, email, phoneNumber and groups they are a part of.

This functionality of listing is available through the CLI and API. I would be able to use local_exec to obtain this information but this is not best practices and I would much prefer to allow terraform to handle this information for me.

New or Affected Resource(s)

To be created:

internal/services/users/all_users_datasource.go
internal/services/users/all_users_datasource_test.go

Potential Terraform Configuration

data "azuread_all_users" "users" {}

References

  • #0000
@manicminer
Copy link
Contributor

manicminer commented Aug 10, 2021

Hi @Threpio, thanks for requesting this!

Have you considered using the azuread_group data source? It has a members attribute, so you could use a high level group containing all the users you wish to manage and discover their object IDs that way?

@Threpio
Copy link
Contributor Author

Threpio commented Aug 10, 2021

@manicminer - I have created a working branch on my fork and confirmed it works for my needs.

Thanks for your speedy comment though. I want to have a catch all as-well and want to move away from a global group in our AAD setup in the future.

I just need to write some tests and I will create the PR.

Am I to create the documentation for this data source aswell? I know some other providers have automated documentation and don't want to duplicate my effort. (Happy to do it otherwise)

@manicminer
Copy link
Contributor

manicminer commented Aug 10, 2021

@Threpio That's great! Please feel free to raise a PR. I think this might be best proposed as an extension to the azuread_users data source, rather than a new data source?

Regarding documentation - we don't yet auto generate as we're in the process of improving our docs coverage and there are a lot of contextual additions like info boxes. There is a docs linter that runs in GH actions, you can run it locally with make docs-lint.

@Threpio
Copy link
Contributor Author

Threpio commented Aug 11, 2021

@manicminer - We did consider developing it as an extension as the azuread_users datasource but figured that the majority of the times that we use that datasource we DO NOT want a result that is not queried/filtered to be returned. So for us it means that if we mis-configure the datasource then it can look to be correct even when not filtered. (Happy to be overrule in this for the greater project)

  • It could be deigned as a all_users flag against the azuread_users datasource but I can't see how the ExactlyOneOf functionality for those inputs would work additionally with a boolean flag?

@github-actions
Copy link

github-actions bot commented Sep 2, 2021

This functionality has been released in v2.1.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

github-actions bot commented Oct 3, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants