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

Add support for event_grouping_setting of azurerm_sentinel_alert_rule_scheduled #10078

Merged
merged 3 commits into from
Jan 19, 2021

Conversation

neil-yechenwei
Copy link
Contributor

@neil-yechenwei neil-yechenwei commented Jan 7, 2021

fixes #9725

Currently azurerm_sentinel_alert_rule_scheduled doesn't support grouping the events. So this PR is to implement it.

The EventGroupingSettings in rest api spec:
https://github.com/Azure/azure-rest-api-specs/blob/96ba256c1f61d4dc2a7928d7658e024b9b1615a6/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/preview/2019-01-01-preview/SecurityInsights.json#L9262

--- PASS: TestAccSentinelAlertRuleScheduled_basic (160.00s)
--- PASS: TestAccSentinelAlertRuleScheduled_complete (160.04s)
--- PASS: TestAccSentinelAlertRuleScheduled_withAlertRuleTemplateGuid (160.07s)
--- PASS: TestAccSentinelAlertRuleScheduled_requiresImport (192.13s)
--- PASS: TestAccSentinelAlertRuleScheduled_updateEventGroupingSetting (222.86s)
--- PASS: TestAccSentinelAlertRuleScheduled_update (290.24s)

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks @neil-yechenwei - overall this looks good but i have one comment about the property name i've left inline

@@ -73,6 +73,24 @@ func resourceSentinelAlertRuleScheduled() *schema.Resource {
ValidateFunc: validation.StringIsNotEmpty,
},

"event_grouping_setting": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can remove setting

Suggested change
"event_grouping_setting": {
"event_grouping": {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"aggregation_kind": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

given there is only one property here? maybe we should pull this out and call it

Suggested change
"aggregation_kind": {
"Event_grouping_aggregation_methold": {

(kind isn't great, methold is more descriptive)

Copy link
Contributor Author

@neil-yechenwei neil-yechenwei Jan 13, 2021

Choose a reason for hiding this comment

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

@katbyte , I am not sure whether api would introduce other properties for setting event grouping in the future. So if I put this out, I still need to update the property schema like this and it would become breaking change once api introduced other properties. Does it make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's "method" not "methold", right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes method, and its up to you, honestly its not a big deal to deprecate a string property if they add one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK. Thanks. I prefer to keep it.

@neil-yechenwei
Copy link
Contributor Author

@katbyte , thanks for your comments. I've updated code and answered your questions. Please have an another look.

Copy link
Collaborator

@katbyte katbyte left a 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 👍

@katbyte katbyte added this to the v2.44.0 milestone Jan 19, 2021
@katbyte katbyte merged commit ef7f03d into hashicorp:master Jan 19, 2021
katbyte added a commit that referenced this pull request Jan 19, 2021
@ghost
Copy link

ghost commented Jan 21, 2021

This has been released in version 2.44.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.44.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Feb 19, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Feb 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants