Skip to content

azurermMonitorActionRuleSuppression

Manages an Monitor Action Rule which type is suppression.

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 azurermMonitorActionRuleSuppressionExample =
  new azurerm.monitorActionRuleSuppression.MonitorActionRuleSuppression(
    this,
    "example_1",
    {
      name: "example-amar",
      resource_group_name: azurermResourceGroupExample.name,
      scope: [
        {
          resource_ids: [azurermResourceGroupExample.id],
          type: "ResourceGroup",
        },
      ],
      suppression: [
        {
          recurrence_type: "Weekly",
          schedule: [
            {
              end_date_utc: "2019-01-03T15:02:07Z",
              recurrence_weekly: ["Sunday", "Monday", "Friday", "Saturday"],
              start_date_utc: "2019-01-01T01:02:03Z",
            },
          ],
        },
      ],
      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.*/
azurermMonitorActionRuleSuppressionExample.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.

  • suppression - (Required) A suppression block as defined below.

  • 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 suppression block supports the following:

  • recurrenceType - (Required) Specifies the type of suppression. Possible values are always, daily, monthly, once, and weekly.

  • schedule - (Optional) A schedule block as defined below. Required if recurrenceType is daily, monthly, once or weekly.


The schedule block supports the following:

  • startDateUtc - (Required) specifies the recurrence UTC start datetime (Y-m-d'T'H:M:S'Z').

  • endDateUtc - (Required) specifies the recurrence UTC end datetime (Y-m-d'T'H:M:S'Z').

  • recurrenceWeekly - (Optional) specifies the list of dayOfWeek to recurrence. Possible values are sunday, monday, tuesday, wednesday, thursday, friday and saturday.

  • recurrenceMonthly - (Optional) specifies the list of dayOfMonth to recurrence. Possible values are between 1 - 31. Required if recurrenceType is monthly.


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_suppression.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AlertsManagement/actionRules/actionRule1