Skip to content

Commit

Permalink
fix(account_team_member): no err on deletion if it does not exist (#1471
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Serpentiel authored Dec 7, 2023
1 parent 5bff291 commit 41c6ce9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ nav_order: 1
- Add `connection_uri` field to components of all services. This field contains connection information for the
component, and is a combination of the `host` and `port` fields
- Add `external_postgresql` and `external_google_cloud_bigquery` service integration endpoints
- Do not return error on `aiven_account_team_member` deletion if the member does not exist

## [4.9.3] - 2023-10-27

Expand Down
8 changes: 3 additions & 5 deletions internal/sdkprovider/service/account/account_team_member.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,21 +205,19 @@ func resourceAccountTeamMemberDelete(ctx context.Context, d *schema.ResourceData
}

// delete account team member
found := false
for _, m := range r.Members {
if m.UserEmail == userEmail {
err = client.AccountTeamMembers.Delete(ctx, accountID, teamID, m.UserId)
if err != nil && !aiven.IsNotFound(err) {
return diag.FromErr(err)
}
found = true
break
}
}

if !found {
return diag.Errorf("user with email %q is not a part of the team %q", userEmail, teamID)
}
// we don't need to return an error if a user is not found in the members list
// because it means that a user was invited but not yet accepted an invitation,
// and we already deleted an invitation above

return nil
}

0 comments on commit 41c6ce9

Please sign in to comment.