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 team_members data source #55

Closed

Conversation

patrickmarabeas
Copy link

Adds team_members data source which allows the lookup of a list of team
members by their email and returns a list of member objects. The data
source also includes an optional field "ignore_missing" which allows
for the graceful filtering of members that return an error. This will
help in the management of members who are added through SSO facilities
and not the team_member Terraform resource.

Adds:

  • launchdarkly_team_members data source

Adds team_members data source which allows the lookup of a list of team
members by their email and returns a list of member objects. The data
source also includes an optional field "ignore_missing" which allows
for the graceful filtering of members that return an error. This will
help in the management of members who are added through SSO facilities
and not the team_member Terraform resource.

Adds:
- launchdarkly_team_members data source
Copy link
Collaborator

@ldhenry ldhenry left a comment

Choose a reason for hiding this comment

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

Hi @patrickmarabeas,

Thanks for submitting this, we are always grateful of outside contributions. I had one suggestion that should be addressed before releasing this data source. Let me know if you don't have time to make the change so I can get someone from our side to take over.

Thanks,
Henry

if emails, ok := d.Get(EMAILS).([]interface{}); ok && len(emails) > 0 {
expectedCount = len(emails)
for _, memberEmail := range emails {
member, err := getTeamMemberByEmail(client, fmt.Sprintf("%s", memberEmail))
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems getTeamMemberByEmail actually just makes an API call to get all team members and then filters the response to return the single member. In this case it would be significantly more efficient to just call client.ld.TeamMembersApi.GetMembers once and then filter the response based on the provided email list.

Probably the best course of action would be to refactor the API call into a new function called getTeamMembers that can be used in getTeamMemberByEmail and in your data source.

@monsagri
Copy link
Contributor

monsagri commented Jan 20, 2022

Hi @patrickmarabeas,

We've added a team_members resource in #77 and released it as part of 2.4.0.

I know it's been a while since the initial request, but please let us know if that works for you.

@monsagri monsagri closed this Jan 20, 2022
@monsagri monsagri reopened this Jan 20, 2022
@ldhenry ldhenry closed this Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants