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_nrt - Add support for techniques #19142

Merged
merged 1 commit into from
Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions internal/services/sentinel/sentinel_alert_rule_nrt_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ func resourceSentinelAlertRuleNrt() *pluginsdk.Resource {
},
},

"techniques": {
Type: pluginsdk.TypeSet,
Optional: true,
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
ValidateFunc: validation.StringIsNotEmpty,
},
},

"incident": {
Type: pluginsdk.TypeList,
Optional: true,
Expand Down Expand Up @@ -341,6 +350,7 @@ func resourceSentinelAlertRuleNrtCreateUpdate(d *pluginsdk.ResourceData, meta in
NrtAlertRuleProperties: &securityinsight.NrtAlertRuleProperties{
Description: utils.String(d.Get("description").(string)),
DisplayName: utils.String(d.Get("display_name").(string)),
Techniques: expandAlertRuleTechnicals(d.Get("techniques").(*pluginsdk.Set).List()),
Tactics: expandAlertRuleTactics(d.Get("tactics").(*pluginsdk.Set).List()),
IncidentConfiguration: expandAlertRuleIncidentConfiguration(d.Get("incident").([]interface{}), "create_incident_enabled", false),
Severity: securityinsight.AlertSeverity(d.Get("severity").(string)),
Expand Down Expand Up @@ -426,6 +436,9 @@ func resourceSentinelAlertRuleNrtRead(d *pluginsdk.ResourceData, meta interface{
if err := d.Set("tactics", flattenAlertRuleTactics(prop.Tactics)); err != nil {
return fmt.Errorf("setting `tactics`: %+v", err)
}
if err := d.Set("techniques", prop.Techniques); err != nil {
return fmt.Errorf("setting `techniques`: %+v", err)
}
if err := d.Set("incident", flattenAlertRuleIncidentConfiguration(prop.IncidentConfiguration, "create_incident_enabled", false)); err != nil {
return fmt.Errorf("setting `incident`: %+v", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ resource "azurerm_sentinel_alert_rule_nrt" "test" {
display_name = "Complete Rule"
description = "Some Description"
tactics = ["Collection", "CommandAndControl"]
techniques = ["T1560", "T1123"]
severity = "Low"
enabled = false
incident {
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/sentinel_alert_rule_nrt.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ The following arguments are supported:

* `tactics` - (Optional) A list of categories of attacks by which to classify the rule. Possible values are `Collection`, `CommandAndControl`, `CredentialAccess`, `DefenseEvasion`, `Discovery`, `Execution`, `Exfiltration`, `Impact`, `InitialAccess`, `LateralMovement`, `Persistence` and `PrivilegeEscalation`.

* `techniques` - (Optional) A list of techniques of attacks by which to classify the rule.

---

An `alert_details_override` block supports the following:
Expand Down