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

azurerm_sentinel_alert_rule_scheduled - support for group_by_{alert|custom}_details, alert_details_override, entity_mapping, custom_details` #15901

Merged

Conversation

magodo
Copy link
Collaborator

@magodo magodo commented Mar 21, 2022

This PR adds a couple of new features for the sentinel scheduled alert rule, to make it 100% property covered.

Fixes #11667, fixes #14244

Test

terraform-provider-azurerm on  main via 🐹 v1.18 took 6m17s
💤  TF_ACC=1 go test -v -timeout=20h ./internal/services/sentinel  -run='TestAccSentinelAlertRuleScheduled_'
=== RUN   TestAccSentinelAlertRuleScheduled_basic
=== PAUSE TestAccSentinelAlertRuleScheduled_basic
=== RUN   TestAccSentinelAlertRuleScheduled_complete
=== PAUSE TestAccSentinelAlertRuleScheduled_complete
=== RUN   TestAccSentinelAlertRuleScheduled_update
=== PAUSE TestAccSentinelAlertRuleScheduled_update
=== RUN   TestAccSentinelAlertRuleScheduled_requiresImport
=== PAUSE TestAccSentinelAlertRuleScheduled_requiresImport
=== RUN   TestAccSentinelAlertRuleScheduled_withAlertRuleTemplateGuid
=== PAUSE TestAccSentinelAlertRuleScheduled_withAlertRuleTemplateGuid
=== RUN   TestAccSentinelAlertRuleScheduled_updateEventGroupingSetting
=== PAUSE TestAccSentinelAlertRuleScheduled_updateEventGroupingSetting
=== CONT  TestAccSentinelAlertRuleScheduled_basic
=== CONT  TestAccSentinelAlertRuleScheduled_requiresImport
=== CONT  TestAccSentinelAlertRuleScheduled_updateEventGroupingSetting
=== CONT  TestAccSentinelAlertRuleScheduled_withAlertRuleTemplateGuid
=== CONT  TestAccSentinelAlertRuleScheduled_update
=== CONT  TestAccSentinelAlertRuleScheduled_complete
--- PASS: TestAccSentinelAlertRuleScheduled_withAlertRuleTemplateGuid (169.39s)
--- PASS: TestAccSentinelAlertRuleScheduled_complete (172.72s)
--- PASS: TestAccSentinelAlertRuleScheduled_basic (176.35s)
--- PASS: TestAccSentinelAlertRuleScheduled_updateEventGroupingSetting (242.41s)
--- PASS: TestAccSentinelAlertRuleScheduled_update (278.09s)
--- PASS: TestAccSentinelAlertRuleScheduled_requiresImport (1456.46s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel      1456.478s

…|custom}_details`, `alert_details_override`, `entity_mapping`, `custom_details`

Add a couple of new features for the sentinel scheduled alert rule, to make it 100% property covered.
@magodo
Copy link
Collaborator Author

magodo commented Mar 21, 2022

There are also some 3.0 TODO(s) for this resource, I'm wondering whether we can resolve them in this PR as well.

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

A few minor comments but this otherwise LGTM 👍

false),
},
},
"group_by_custom_details": {
Copy link
Contributor

Choose a reason for hiding this comment

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

given this is a GroupBy, this'd be implicitly ordered - so should this be a List?

@@ -184,30 +210,31 @@ func resourceSentinelAlertRuleScheduled() *pluginsdk.Resource {
},
},
"group_by": {
Type: pluginsdk.TypeSet,
Copy link
Contributor

Choose a reason for hiding this comment

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

(as below) a GroupBy would be an order-statement in other cases, so is order relevant here/should this be a List?

ValidateFunc: validation.StringInSlice(entityMappingTypes, false),
},
},
"group_by_alert_details": {
Type: pluginsdk.TypeSet,
Copy link
Contributor

Choose a reason for hiding this comment

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

(as below) a GroupBy would be an order-statement in other cases, so is order relevant here/should this be a List?

@magodo
Copy link
Collaborator Author

magodo commented Mar 22, 2022

Thanks @tombuildsstuff! Besides these, do you mind I also:

  1. Rename the group_by to group_by_identities to make it more clear
  2. Fix the TODO-3.0(s) in this file, which mostly about mapping some enums which were changed in a previous API version

@tombuildsstuff
Copy link
Contributor

@magodo I hope you don't mind but I've pushed a commit for 2 since I'm working through the rest of the codebase in a separate branch and wanted to ensure this PR contains it 👍

For 1 it seems reasonable - I'll leave that for you 👍

@tombuildsstuff
Copy link
Contributor

We'll also need to add these to the 3.0 upgrade guide fwiw - presumably something along the lines of

azurerm_sentinel_alert_rule_scheduled - the field entity_matching_method can no longer be set to the legacy values All, Custom or None - use AnyAlert, Selected and AllEntities instead

@magodo
Copy link
Collaborator Author

magodo commented Mar 22, 2022

Thanks @tombuildsstuff! I've made the change for 1 and update the upgrade document for this resource, please take another look!

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@tombuildsstuff tombuildsstuff merged commit 00ae4ce into hashicorp:main Mar 23, 2022
tombuildsstuff added a commit that referenced this pull request Mar 23, 2022
@github-actions
Copy link

This functionality has been released in v3.0.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants