-
Notifications
You must be signed in to change notification settings - Fork 3
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
ENG-13251: Add optional MongoDBSettings 'flavor' field to repository resource #503
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but let's wait until we hear from Wilson
@@ -263,10 +279,18 @@ func (r *RepoInfo) MongoDBSettingsFromInterface(i []interface{}) error { | |||
Standalone, | |||
) | |||
} | |||
if serverType == Sharded && mongoFlavor == MongoDBFlavorDocumentDB { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have validation for this combination in crud
, so I don't think we should do it here too. I feel like the terraform provider should not encode these validations, but rather they should be left to the gRPC/REST implementation.
That said, that's just my opinion, and I don't know what's the idiomatic thing to do. Let's see what @wcmjunior thinks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am fine with both, we can wait for wilson.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is ok to have the validation only in the backend as long as it provides an error message that actually helps the user to solve the problem. If it returns something like Invalid parameter
it does not help, but if it returns something in the lines of Parameter X must be 'Y' or 'Z'
it is ok.
if serverType == Sharded && mongoFlavor == MongoDBFlavorDocumentDB { | ||
return fmt.Errorf( | ||
"%q MongoDB flavor cannot be combined with server type: %q. For configuring "+ | ||
"DocumentDB Elastic clusters, please use the %s server type", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both standalone and replicaset work with DocumentDB, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on Wilson's comment I'll approve now so that you're not blocked on me whenever you make the necessary changes.
@ricardorey10 I just removed the local validation, as requested. This is the new output:
|
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM. Please also point out (a comment is fine) which is the minimum version of CP required to use the new attribute so I can add to the change log.
v4.12.3 is the minimum Control Plane version to use the new attribute. |
Description of the change
ENG-13251: Add Flavor as an Optional MongoDBSettings field. Repository resource.
Type of change
Checklists
Development
Code review
Testing
mongodb
can be used withreplicaset
mongodb
can be used withstandalone
mongodb
can be used withsharded
documentdb
can be used withstandalone
documentdb
can be used withreplicaset
documentdb
cannot be used withsharded
.