Skip to content

INTMDB-298: fixes a bug where you couldn't delete a team in team resource #668

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

Merged
merged 3 commits into from
Feb 5, 2022

Conversation

coderGo93
Copy link
Contributor

@coderGo93 coderGo93 commented Jan 31, 2022

Description

  • Fixes a bug when you get an error of CANNOT_DELETE_TEAM_ASSIGNED_TO_PROJECT when trying to delete one team in team resource

Link to any related issue(s): #662

Type of change:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the Terraform contribution guidelines
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code

Further comments

Copy link
Collaborator

@themantissa themantissa left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@thetonymaster thetonymaster left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@andreaangiolillo andreaangiolillo left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines +224 to +232
var target *matlas.ErrorResponse
if errors.As(err, &target) && target.ErrorCode != "USER_UNAUTHORIZED" {
return diag.Errorf("error removing team(%s) from the project(%s): %s", teamID, projectID, err)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

[nit] I wouldn’t silently ignore the error USER_UNAUTHORIZED but at least print a warning so that the user is aware that the team removal operation failed because they don't have the correct permission.

@coderGo93 coderGo93 merged commit f151071 into master Feb 5, 2022
@coderGo93 coderGo93 deleted the INTMDB-298 branch February 5, 2022 06:25
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.

4 participants