Add a datasource for members of an organization
Problem: The mongodbatlas_teams
resource only works with email addresses of user accounts which are existing members of the organization at apply time¹, and Team memberships can't (yet?) be managed via Identity Federation (third-party SAML IdP).
Solution: If there was a datasource using the "Get All Organization Users" API² to return a list of organization members, that data could be used to filter the usernames
input attribute of the mongodbatlas_teams
resource to only add valid users.
Workaround: We're using a Python script as an external datasource to get the data needed to perform said filtering.
¹: An error is thrown when trying to add a user who hasn't logged into Atlas or isn't part of the organization: 401 (request "NOT_USER_ADMIN") The currently logged in user does not have the user administrator role for any group, team, or organization containing user.
![](https://secure.gravatar.com/avatar/04ffbdf724088703aaebb22afefa4f3c?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)
this feature has has been released as part of v1.10.0 release. thank you for the feedback.
for more details see: https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/data-sources/organizations
-
AdminZuhair (Admin, MongoDB) commented
Thanks for sharing feedback Thorben. We have added this to our v1.9.0 sprint cycle and you should see support for a new "Get All Organization Users" data source then (likely 1-2 months away). Hope this helps