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

INTMDB-295: Fixes a bug about unauthorized error in project resource #664

Merged
merged 2 commits into from
Feb 4, 2022

Conversation

coderGo93
Copy link
Contributor

Description

  • Fixes a bug where it appears about unauthorized error when getting api keys if you have organization read permission.

Link to any related issue(s):
#659

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
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.

One small comment

Comment on lines 143 to 147
var target *matlas.ErrorResponse
if errors.As(err, &target) && target.ErrorCode != "USER_UNAUTHORIZED" {
return diag.Errorf("error getting project's api keys (%s): %s", 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.

based on this change, apiKeys will still be empty when the request getProjectAPIKeys returns the error USER_UNAUTHORIZED so I would print a warning explaining why this field is empty.

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

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

@coderGo93 coderGo93 merged commit 63fadd6 into master Feb 4, 2022
@coderGo93 coderGo93 deleted the INTMDB-295 branch February 4, 2022 15:01
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