-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
azurerm_mongo_cluster
- remove the check logic for administrator_password
#28215
Conversation
if state.AdministratorPassword == "" { | ||
return fmt.Errorf("`administrator_password` is required when `create_mode` is %s", string(mongoclusters.CreateModeDefault)) | ||
} |
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.
This validation should probably be moved to the Create function instead of removed entirely
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.
Even if the validation is placed in the create function, this code will never be hit because administrator_username
already has the constraint RequiredWith: []string{"administrator_password"}
.
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.
Thanks for pointing that out 👍
@stephybun , thanks for the comments. I left suggestion. Please take another look. |
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.
Thanks @neil-yechenwei LGTM 👍
Community Note
Description
When running tf apply, the logic in CustomizeDiff checks if the AdministratorPassword is empty, but at that point, random_password has not yet generated the value, so the check fails. To fix this issue, the check for AdministratorPassword can be removed, as the logic for checking AdministratorUsername already exists in CustomizeDiff, and this field has the
RequiredWith: []string{"administrator_password"}
validation. Therefore, redundant checks in CustomizeDiff are not necessary.PR Checklist
For example: “
resource_name_here
- description of change e.g. adding propertynew_property_name_here
”Changes to existing Resource / Data Source
Testing
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_mongo_cluster
- remove the check logic foradministrator_password
This is a (please select all that apply):
Related Issue(s)
Fixes #28204
Note
If this PR changes meaningfully during the course of review please update the title and description as required.