-
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_postgresql_flexible_server
- fix a potential panic
#20052
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.
Hi @ziyeqf - Thanks for this PR.
I think we could approach this a different way to assist users by catching the problem at plan time, and ensuring that the block cannot be empty by using schema constraints, for example:
AtLeastOneOf: []string{
"authentication.0.active_directory_auth_enabled",
"authentication.0.password_auth_enabled",
"authentication.0.tenant_id",
},
on each item in authentication
, WDYT?
7002b61
to
c2c474f
Compare
Make sense, code updated, thanks! |
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.
Hi @ziyeqf
Thanks for making those changes, LGTM 👍
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 @ziyeqf
Apologies for the mistaken approval earlier, my mistake, hadn't had coffee yet 🙈 .
wrt combining with #20054, only one of these fixes should be required, hence asking to consider rolling them up / closing one. Both would result in guarding users against providing an invalid config. The simplest would be to set default: true
on password_auth_enabled
, so I think we should close this one, and run with/merge 20054?
AtLeastOneOf: []string{ | ||
"authentication.0.active_directory_auth_enabled", | ||
"authentication.0.password_auth_enabled", | ||
}, |
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 should be on each of the properties inside the block, so below would look like:
"active_directory_auth_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
AtLeastOneOf: []string{
"authentication.0.active_directory_auth_enabled",
"authentication.0.password_auth_enabled",
},
},
"password_auth_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
AtLeastOneOf: []string{
"authentication.0.active_directory_auth_enabled",
"authentication.0.password_auth_enabled",
},
},
"tenant_id": {
Type: pluginsdk.TypeString,
Optional: true,
ValidateFunc: validation.IsUUID,
RequiredWith: []string{
"authentication.0.active_directory_auth_enabled",
},
},
},
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
It will panic when
authentication
is specified with empty block. add a runtime check for it