feat: upsert team members by email#443
Open
despreston wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
adopt_existingargument tolaunchdarkly_team_member.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.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 fmtcheckGOFLAGS='' 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 withoutTF_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.