Skip to content

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) A condition block as defined below.

  • description - (Optional) Specifies a description for the Alert Processing Rule.

  • enabled - (Optional) Should the Alert Processing Rule be enabled? Defaults to true.

  • schedule - (Optional) A schedule 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 are equals, notEquals, contains, and doesNotContain.

  • 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 are equals, notEquals, contains, and doesNotContain.

  • 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 are equals, notEquals, contains, and doesNotContain.

  • values - (Required) Specifies a list of values to match for a given condition.


A condition block supports the following:

  • alertContext - (Optional) A alertContext block as defined above.

  • alertRuleId - (Optional) A alertRuleId block as defined above.

  • alertRuleName - (Optional) A alertRuleName block as defined above.

  • description - (Optional) A description block as defined below.

  • monitorCondition - (Optional) A monitorCondition block as defined below.

  • monitorService - (Optional) A monitorService block as defined below.

  • severity - (Optional) A severity block as defined below.

  • signalType - (Optional) A signalType block as defined below.

  • targetResource - (Optional) A targetResource block as defined below.

  • targetResourceGroup - (Optional) A targetResourceGroup block as defined below.

  • targetResourceType - (Optional) A targetResourceType 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 are equals, notEquals, contains, and doesNotContain.

  • 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 are equals and notEquals.

  • values - (Required) Specifies a list of values to match for a given condition. Possible values are fired and resolved.


A monitorService block supports the following:

  • operator - (Required) The operator for a given condition. Possible values are equals and notEquals.

  • values - (Required) A list of values to match for a given condition. Possible values are activityLogAdministrative, activityLogAutoscale, activityLogPolicy, activityLogRecommendation, activityLogSecurity, applicationInsights, azureBackup, azureStackEdge, azureStackHub, custom, dataBoxGateway, healthPlatform, logAlertsV2, logAnalytics, platform, prometheus, resourceHealth, smartDetector, and vmInsightsHealth.


A monthly block supports the following:

  • daysOfMonth - (Required) Specifies a list of dayOfMonth to recurrence. Possible values are integers between 1 - 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 more daily blocks as defined above.

  • weekly - (Optional) One or more weekly blocks as defined below.

  • monthly - (Optional) One or more monthly 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) A recurrence block as defined above.

  • timeZone - (Optional) The time zone (e.g. Pacific Standard time, Eastern Standard Time). Defaults to utc. possible values are defined here.


A severity block supports the following:

  • operator - (Required) The operator for a given condition. Possible values are equals and notEquals.

  • values - (Required) Specifies list of values to match for a given condition. Possible values are sev0, sev1, sev2, sev3, and sev4.


A signalType block supports the following:

  • operator - (Required) The operator for a given condition. Possible values are equals and notEquals.

  • values - (Required) Specifies a list of values to match for a given condition. Possible values are metric, log, unknown, and health.


A targetResource block supports the following:

  • operator - (Required) The operator for a given condition. Possible values are equals, notEquals, contains, and doesNotContain.

  • 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 are equals, notEquals, contains, and doesNotContain.

  • 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 are equals, notEquals, contains, and doesNotContain.

  • 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 are sunday, monday, tuesday, wednesday, thursday, friday, and saturday.

  • 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.

terraform import azurerm_monitor_alert_processing_rule_action_group.example /subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/group1/providers/Microsoft.AlertsManagement/actionRules/actionRule1