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

Manage launchdarkly_team_member where the email exists in more than one launchdarkly_team resource. #184

Closed
scuba10steve opened this issue Sep 22, 2023 · 3 comments

Comments

@scuba10steve
Copy link

scuba10steve commented Sep 22, 2023

Currently, it appears that the provider tries to create the member if it doesn't exist yet, then add that member to the team. I do have a situation where I have the need to add the same email to multiple teams.

example:

resource "launchdarkly_team_member" "developer" {
  count = length(var.team_members)

  email = element(var.team_members, count.index)
  role = "reader"
}

This is pulled into a module, and then referenced more than once with the same email. e.g.

module "team-a" {
    source "./team"
    
    team_members = [ "[email protected]"]
}

module "team-b" {
    source "./team"
    
    team_members = [ "[email protected]"]
}

So I'm not expecting that the behavior of the launchdarkly_team_member resource to change, however I would like to be able to map multiple members with the same email. If there's a workaround to do this now, I'm willing to try it.

Example error:

Error: failed to create team member with email: [email protected]: 400 Bad Request: {"code":"email_already_exists_in_account","message":"Members with the following e-mail addresses already exist in this account: [email protected]","invalid_emails":["[email protected]"]}

│ with module.team-b.launchdarkly_team_member.developer[1],
│ on team/team.tf line 10, in resource "launchdarkly_team_member" "developer":
│ 10: resource "launchdarkly_team_member" "developer" {

@scuba10steve scuba10steve changed the title Manage launchdarkly_team_members where the email exists in more than one launchdarkly_team resource. Manage launchdarkly_team_member where the email exists in more than one launchdarkly_team resource. Sep 22, 2023
@scuba10steve
Copy link
Author

This can also be triggered if the email exists as an account member, but not associated with any teams.

@ldhenry
Copy link
Collaborator

ldhenry commented Oct 13, 2023

Hey @scuba10steve,

I think the issue is you have multiple modules that are attempting to create the same team member. Would it be possible to create the team members in a different module and pass the relevant team members into a module that just defines the LaunchDarkly team resource?

Sorry for the delayed response,
Henry

@scuba10steve
Copy link
Author

I believe that may be possible, I found a workaround by importing the member manually for now.

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

No branches or pull requests

3 participants