Skip to content

Commit

Permalink
azurerm_monitor_activity_log_alert: support `properties.recommendatio…
Browse files Browse the repository at this point in the history
…nType` for recommendation alerts
  • Loading branch information
magodo committed Jun 24, 2020
1 parent 81a042b commit 4b08892
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ func resourceArmMonitorActivityLogAlert() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"recommendation_type": {
Type: schema.TypeString,
Optional: true,
},
},
},
},
Expand Down Expand Up @@ -348,6 +352,12 @@ func expandMonitorActivityLogAlertCriteria(input []interface{}) *insights.Activi
Equals: utils.String(subStatus),
})
}
if recommendationType := v["recommendation_type"].(string); recommendationType != "" {
conditions = append(conditions, insights.ActivityLogAlertLeafCondition{
Field: utils.String("properties.recommendationType"),
Equals: utils.String(recommendationType),
})
}

return &insights.ActivityLogAlertAllOfCondition{
AllOf: &conditions,
Expand Down Expand Up @@ -397,6 +407,8 @@ func flattenMonitorActivityLogAlertCriteria(input *insights.ActivityLogAlertAllO
result["resource_id"] = *condition.Equals
case "substatus":
result["sub_status"] = *condition.Equals
case "recommendationType":
result["recommendation_type"] = *condition.Equals
case "caller", "category", "level", "status":
result[*condition.Field] = *condition.Equals
}
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/monitor_activity_log_alert.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ A `criteria` block supports the following:
* `level` - (Optional) The severity level of the event. Possible values are `Verbose`, `Informational`, `Warning`, `Error`, and `Critical`.
* `status` - (Optional) The status of the event. For example, `Started`, `Failed`, or `Succeeded`.
* `sub_status` - (Optional) The sub status of the event.
* `recommendation_type` - (Optional) The recommendation type of the event. It is only allowed when `category` is `Recommendation`.

## Attributes Reference

Expand Down

0 comments on commit 4b08892

Please sign in to comment.