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

Database user scopes #307

Merged
merged 5 commits into from
Sep 18, 2020
Merged

Database user scopes #307

merged 5 commits into from
Sep 18, 2020

Conversation

coderGo93
Copy link
Contributor

@coderGo93 coderGo93 commented Sep 4, 2020

Description

Added a parameter called scopes for database user and its testacc

Link to any related issue(s):

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 requirments
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code

Further comments

@leofigy
Copy link
Contributor

leofigy commented Sep 4, 2020

Looks good , so your change consists in

mongodbatlas/data_source_mongodbatlas_database_user.go mongodbatlas/data_source_mongodbatlas_database_users.go mongodbatlas/data_source_mongodbatlas_database_users_test.go mongodbatlas/resource_mongodbatlas_database_user.go mongodbatlas/resource_mongodbatlas_database_user_test.go

question @coderGo93 , the client library, update was intented? just curious :)

@coderGo93
Copy link
Contributor Author

@leofigy That's correct, the client library needed an update because the variable Scope didn't exist, so I updated and now it appears and can be used.

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.

Just a few minor docs improvements and a question. Thanks!!

Comment on lines +43 to +46
scopes {
name = "My cluster name"
type = "CLUSTER"
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we include more than one scope in one of the examples? I think that will be common and I know a few users were confused on how to do more than one label.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, not problem, thank you

@@ -105,6 +105,25 @@ func resourceMongoDBAtlasDatabaseUser() *schema.Resource {
},
},
},
"scopes": {
Type: schema.TypeList,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just a question for my own curiosity, but labels is the same format in the API so why is that a TypeSet and this a TypeList? I don't see why ordered vs unordered would be different?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, I'll change it, is better same like labels with TypeSet, thank you so much

@@ -74,6 +84,9 @@ Accepted values include:
* `roles` - (Required) List of user’s roles and the databases / collections on which the roles apply. A role allows the user to perform particular actions on the specified database. A role on the admin database can include privileges that apply to the other databases as well. See [Roles](#roles) below for more details.
* `username` - (Required) Username for authenticating to MongoDB.
* `password` - (Required) User's initial password. A value is required to create the database user, however the argument but may be removed from your Terraform configuration after user creation without impacting the user, password or Terraform management. IMPORTANT --- Passwords may show up in Terraform related logs and it will be stored in the Terraform state file as plain-text. Password can be changed after creation using your preferred method, e.g. via the MongoDB Atlas UI, to ensure security. If you do change management of the password to outside of Terraform be sure to remove the argument from the Terraform configuration so it is not inadvertently updated to the original password.
* `scopes` - (Optional) Array of clusters and Atlas Data Lakes that this user has access to. If omitted, Atlas grants the user access to all the clusters and Atlas Data Lakes in the project by default.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd also break this out more like labels in that it can be more than one name/type (e.g. you could have two clusters and a data lake to one user).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure not problem

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, thank you!! just get a DoU review as well please.

@coderGo93 coderGo93 requested a review from leofigy September 16, 2020 21:20
Copy link
Contributor

@leofigy leofigy left a comment

Choose a reason for hiding this comment

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

hey LGTM

@coderGo93 coderGo93 merged commit e3606de into master Sep 18, 2020
@coderGo93 coderGo93 deleted the databaseUser-scopes branch September 18, 2020 06:10
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.

3 participants