azurermMonitorAlertProcessingRuleActionGroup
Manages an Alert Processing Rule which apply action group.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West Europe",
name: "example-resources",
}
);
const azurermMonitorActionGroupExample =
new azurerm.monitorActionGroup.MonitorActionGroup(this, "example_1", {
name: "example-action-group",
resource_group_name: azurermResourceGroupExample.name,
short_name: "exampleactiongroup",
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMonitorActionGroupExample.overrideLogicalId("example");
const azurermMonitorAlertProcessingRuleActionGroupExample =
new azurerm.monitorAlertProcessingRuleActionGroup.MonitorAlertProcessingRuleActionGroup(
this,
"example_2",
{
add_action_group_ids: [azurermMonitorActionGroupExample.id],
condition: [
{
severity: [
{
operator: "Equals",
values: ["Sev0", "Sev1", "Sev2"],
},
],
target_resource_type: [
{
operator: "Equals",
values: ["Microsoft.Compute/VirtualMachines"],
},
],
},
],
name: "example",
resource_group_name: "example",
schedule: [
{
effective_from: "2022-01-01T01:02:03",
effective_until: "2022-02-02T01:02:03",
recurrence: [
{
daily: [
{
end_time: "09:00:00",
start_time: "17:00:00",
},
],
weekly: [
{
days_of_week: ["Saturday", "Sunday"],
},
],
},
],
time_zone: "Pacific Standard Time",
},
],
scopes: [azurermResourceGroupExample.id],
tags: {
foo: "bar",
},
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermMonitorAlertProcessingRuleActionGroupExample.overrideLogicalId(
"example"
);
Arguments Reference
The following arguments are supported:
-
addActionGroupIds
- (Required) Specifies a list of Action Group IDs. -
name
- (Required) The name which should be used for this Alert Processing Rule. Changing this forces a new Alert Processing Rule to be created. -
resourceGroupName
- (Required) The name of the Resource Group where the Alert Processing Rule should exist. Changing this forces a new Alert Processing Rule to be created. -
scopes
- (Required) A list of resource IDs which will be the target of alert processing rule.
-
condition
- (Optional) Acondition
block as defined below. -
description
- (Optional) Specifies a description for the Alert Processing Rule. -
enabled
- (Optional) Should the Alert Processing Rule be enabled? Defaults totrue
. -
schedule
- (Optional) Aschedule
block as defined below. -
tags
- (Optional) A mapping of tags which should be assigned to the Alert Processing Rule.
A alertContext
block supports the following:
-
operator
- (Required) The operator for a given condition. Possible values areequals
,notEquals
,contains
, anddoesNotContain
. -
values
- (Required) Specifies a list of values to match for a given condition.
A alertRuleId
block supports the following:
-
operator
- (Required) The operator for a given condition. Possible values areequals
,notEquals
,contains
, anddoesNotContain
. -
values
- (Required) Specifies a list of values to match for a given condition.
A alertRuleName
block supports the following:
-
operator
- (Required) The operator for a given condition. Possible values areequals
,notEquals
,contains
, anddoesNotContain
. -
values
- (Required) Specifies a list of values to match for a given condition.
A condition
block supports the following:
-
alertContext
- (Optional) AalertContext
block as defined above. -
alertRuleId
- (Optional) AalertRuleId
block as defined above. -
alertRuleName
- (Optional) AalertRuleName
block as defined above. -
description
- (Optional) Adescription
block as defined below. -
monitorCondition
- (Optional) AmonitorCondition
block as defined below. -
monitorService
- (Optional) AmonitorService
block as defined below. -
severity
- (Optional) Aseverity
block as defined below. -
signalType
- (Optional) AsignalType
block as defined below. -
targetResource
- (Optional) AtargetResource
block as defined below. -
targetResourceGroup
- (Optional) AtargetResourceGroup
block as defined below. -
targetResourceType
- (Optional) AtargetResourceType
block as defined below.
-> Note: At least one of the alertContext
, alertRuleId
, alertRuleName
, description
, monitorCondition
, monitorService
, severity
, signalType
, targetResource
, targetResourceGroup
, targetResourceType
must be specified.
A daily
block supports the following:
-
startTime
- (Required) Specifies the recurrence start time (H:M:S). -
endTime
- (Required) Specifies the recurrence end time (H:M:S).
A description
block supports the following:
-
operator
- (Required) The operator for a given condition. Possible values areequals
,notEquals
,contains
, anddoesNotContain
. -
values
- (Required) Specifies a list of values to match for a given condition.
A monitorCondition
block supports the following:
-
operator
- (Required) The operator for a given condition. Possible values areequals
andnotEquals
. -
values
- (Required) Specifies a list of values to match for a given condition. Possible values arefired
andresolved
.
A monitorService
block supports the following:
-
operator
- (Required) The operator for a given condition. Possible values areequals
andnotEquals
. -
values
- (Required) A list of values to match for a given condition. Possible values areactivityLogAdministrative
,activityLogAutoscale
,activityLogPolicy
,activityLogRecommendation
,activityLogSecurity
,applicationInsights
,azureBackup
,azureStackEdge
,azureStackHub
,custom
,dataBoxGateway
,healthPlatform
,logAlertsV2
,logAnalytics
,platform
,prometheus
,resourceHealth
,smartDetector
, andvmInsightsHealth
.
A monthly
block supports the following:
-
daysOfMonth
- (Required) Specifies a list of dayOfMonth to recurrence. Possible values are integers between1
-31
. -
startTime
- (Optional) Specifies the recurrence start time (H:M:S). -
endTime
- (Optional) Specifies the recurrence end time (H:M:S).
A recurrence
block supports the following:
-
daily
- (Optional) One or moredaily
blocks as defined above. -
weekly
- (Optional) One or moreweekly
blocks as defined below. -
monthly
- (Optional) One or moremonthly
blocks as defined above.
A schedule
block supports the following:
-
effectiveFrom
- (Optional) Specifies the Alert Processing Rule effective start time (Y-m-d'T'H:M:S). -
effectiveUntil
- (Optional) Specifies the Alert Processing Rule effective end time (Y-m-d'T'H:M:S). -
recurrence
- (Optional) Arecurrence
block as defined above. -
timeZone
- (Optional) The time zone (e.g. Pacific Standard time, Eastern Standard Time). Defaults toutc
. possible values are defined here.
A severity
block supports the following:
-
operator
- (Required) The operator for a given condition. Possible values areequals
andnotEquals
. -
values
- (Required) Specifies list of values to match for a given condition. Possible values aresev0
,sev1
,sev2
,sev3
, andsev4
.
A signalType
block supports the following:
-
operator
- (Required) The operator for a given condition. Possible values areequals
andnotEquals
. -
values
- (Required) Specifies a list of values to match for a given condition. Possible values aremetric
,log
,unknown
, andhealth
.
A targetResource
block supports the following:
-
operator
- (Required) The operator for a given condition. Possible values areequals
,notEquals
,contains
, anddoesNotContain
. -
values
- (Required) A list of values to match for a given condition. The values should be valid resource IDs.
A targetResourceGroup
block supports the following:
-
operator
- (Required) The operator for a given condition. Possible values areequals
,notEquals
,contains
, anddoesNotContain
. -
values
- (Required) A list of values to match for a given condition. The values should be valid resource group IDs.
A targetResourceType
block supports the following:
-
operator
- (Required) The operator for a given condition. Possible values areequals
,notEquals
,contains
, anddoesNotContain
. -
values
- (Required) A list of values to match for a given condition. The values should be valid resource types. (e.g. Microsoft.Compute/VirtualMachines)
A weekly
block supports the following:
-
daysOfWeek
- (Required) Specifies a list of dayOfWeek to recurrence. Possible values aresunday
,monday
,tuesday
,wednesday
,thursday
,friday
, andsaturday
. -
startTime
- (Optional) Specifies the recurrence start time (H:M:S). -
endTime
- (Optional) Specifies the recurrence end time (H:M:S).
Attributes Reference
In addition to the Arguments listed above - the following Attributes are exported:
id
- The ID of the Alert Processing Rule.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Alert Processing Rule.read
- (Defaults to 5 minutes) Used when retrieving the Alert Processing Rule.update
- (Defaults to 30 minutes) Used when updating the Alert Processing Rule.delete
- (Defaults to 30 minutes) Used when deleting the Alert Processing Rule.
Import
Alert Processing Rules can be imported using the resourceId
, e.g.