Skip to content

azurermApplicationInsightsSmartDetectionRule

Manages an Application Insights Smart Detection Rule.

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: "tf-test",
  }
);
const azurermApplicationInsightsExample =
  new azurerm.applicationInsights.ApplicationInsights(this, "example_1", {
    application_type: "web",
    location: azurermResourceGroupExample.location,
    name: "tf-test-appinsights",
    resource_group_name: azurermResourceGroupExample.name,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermApplicationInsightsExample.overrideLogicalId("example");
const azurermApplicationInsightsSmartDetectionRuleExample =
  new azurerm.applicationInsightsSmartDetectionRule.ApplicationInsightsSmartDetectionRule(
    this,
    "example_2",
    {
      application_insights_id: azurermApplicationInsightsExample.id,
      enabled: false,
      name: "Slow server response time",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermApplicationInsightsSmartDetectionRuleExample.overrideLogicalId(
  "example"
);

Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the Application Insights Smart Detection Rule. Valid values include slowPageLoadTime, slowServerResponseTime, longDependencyDuration, degradationInServerResponseTime, degradationInDependencyDuration, degradationInTraceSeverityRatio, abnormalRiseInExceptionVolume, potentialMemoryLeakDetected, potentialSecurityIssueDetected and abnormalRiseInDailyDataVolume, longDependencyDuration, degradationInServerResponseTime, degradationInDependencyDuration, degradationInTraceSeverityRatio, abnormalRiseInExceptionVolume, potentialMemoryLeakDetected, potentialSecurityIssueDetected, abnormalRiseInDailyDataVolume. Changing this forces a new resource to be created.

  • applicationInsightsId - (Required) The ID of the Application Insights component on which the Smart Detection Rule operates. Changing this forces a new resource to be created.

  • enabled - (Optional) Is the Application Insights Smart Detection Rule enabled? Defaults to true.

  • sendEmailsToSubscriptionOwners - (Optional) Do emails get sent to subscription owners? Defaults to true.

  • additionalEmailRecipients - (Optional) Specifies a list of additional recipients that will be sent emails on this Application Insights Smart Detection Rule.

-> Note: At least one read or write permission must be defined.

Attributes Reference

The following attributes are exported:

  • id - The ID of the Application Insights Smart Detection Rule.

Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the Application Insights Smart Detection Rule
  • update - (Defaults to 30 minutes) Used when updating the Application Insights Smart Detection Rule.
  • read - (Defaults to 5 minutes) Used when retrieving the Application Insights Smart Detection Rule.
  • delete - (Defaults to 30 minutes) Used when deleting the Application Insights Smart Detection Rule.

Import

Application Insights Smart Detection Rules can be imported using the resourceId, e.g.

terraform import azurerm_application_insights_smart_detection_rule.rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Insights/components/mycomponent1/smartDetectionRule/myrule1