Skip to content

azurermMonitorActionRuleActionGroup

Manages an Monitor Action Rule which type is 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: "example",
  });
/*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 azurermMonitorActionRuleActionGroupExample =
  new azurerm.monitorActionRuleActionGroup.MonitorActionRuleActionGroup(
    this,
    "example_2",
    {
      action_group_id: azurermMonitorActionGroupExample.id,
      name: "example-amar",
      resource_group_name: azurermResourceGroupExample.name,
      scope: [
        {
          resource_ids: [azurermResourceGroupExample.id],
          type: "ResourceGroup",
        },
      ],
      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.*/
azurermMonitorActionRuleActionGroupExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the Monitor Action Rule. Changing this forces a new resource to be created.

  • resourceGroupName - (Required) Specifies the name of the resource group in which the Monitor Action Rule should exist. Changing this forces a new resource to be created.

  • actionGroupId - (Required) Specifies the resource id of monitor action group.

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

  • enabled - (Optional) Is the Action Rule enabled? Defaults to true.

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

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

  • tags - (Optional) A mapping of tags to assign to the resource.


The scope block supports the following:

  • type - (Required) Specifies the type of target scope. Possible values are resourceGroup and resource.

  • resourceIds - (Required) A list of resource IDs of the given scope type which will be the target of action rule.


The condition block supports the following:

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

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

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

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

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

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

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


The alertContext 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 alertRuleId 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 description 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 monitor 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 fired and resolved.


The 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, resourceHealth, smartDetector and vmInsightsHealth.


The severity block supports the following:

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

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


The targetResourceType 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. The values should be valid resource types.


Attributes Reference

The following attributes are exported:

  • id - The ID of the Monitor Action Rule.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Monitor Action Rule.
  • read - (Defaults to 5 minutes) Used when retrieving the Monitor Action Rule.
  • update - (Defaults to 30 minutes) Used when updating the Monitor Action Rule.
  • delete - (Defaults to 30 minutes) Used when deleting the Monitor Action Rule.

Import

Monitor Action Rule can be imported using the resourceId, e.g.

terraform import azurerm_monitor_action_rule_action_group.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AlertsManagement/actionRules/actionRule1