Skip to content

feat: upsert team members by email#443

Open
despreston wants to merge 1 commit into
launchdarkly:mainfrom
despreston:add-team-member-adoption
Open

feat: upsert team members by email#443
despreston wants to merge 1 commit into
launchdarkly:mainfrom
despreston:add-team-member-adoption

Conversation

@despreston
Copy link
Copy Markdown

@despreston despreston commented May 26, 2026

Summary

  • Add an opt-in adopt_existing argument to launchdarkly_team_member.
  • When LaunchDarkly returns email_already_exists_in_account, look up the member by email, set the Terraform state ID, and run the existing update/read flow for mutable fields.
  • Document that adopted members can have role/custom role/role attribute fields reconciled, but first and last names cannot be updated by admins.

Why

Many organizations gradually move LaunchDarkly account membership into Terraform after users have already been invited manually, through SSO, or by another automation path. In those setups, a Terraform apply that tries to grant or reconcile access for an existing member currently fails at create time because the email address already exists in the account. This option lets teams explicitly choose to adopt that existing member into state and continue reconciling the fields Terraform can manage, without changing the default create-only behavior for users who want strict ownership semantics.

Testing

  • GOFLAGS='' PATH=/home/ubuntu/co/backend/opt/go1.24.2/bin:$PATH make fmtcheck
  • GOFLAGS='' PATH=/home/ubuntu/co/backend/opt/go1.24.2/bin:$PATH /home/ubuntu/co/backend/opt/go1.24.2/bin/go test ./launchdarkly -run '^$'
  • GOFLAGS='' PATH=/home/ubuntu/co/backend/opt/go1.24.2/bin:$PATH /home/ubuntu/co/backend/opt/go1.24.2/bin/go test ./launchdarkly -run '^TestAccTeamMember_AdoptExisting$' -count=1 (skips locally without TF_ACC)

I also ran go test ./launchdarkly -run 'Test[^A]'; it compiles but currently fails on unrelated tests on this checkout: Test404RetryClient, TestEnvironmentToResourceData, TestValidateRuleResourceData, TestViewRequestsIncludeUserAgentHeader, and team maintainer fixture tests.

@despreston despreston requested review from a team as code owners May 26, 2026 20:20
@despreston despreston changed the title feat: adopt existing team members by email feat: upsert team members by email May 26, 2026
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.

1 participant