Skip to content

azurermDatadogMonitorTagRule

Manages TagRules on the datadog Monitor.

Example Usage

Adding TagRules on monitor

/*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.*/
new azurerm.datadogMonitorTagRule.DatadogMonitorTagRule(this, "example", {
  datadog_monitor_id: "${azurerm_datadog_monitor.example.id}",
  log: [
    {
      subscription_log_enabled: true,
    },
  ],
  metric: [
    {
      filter: [
        {
          action: "Include",
          name: "Test",
          value: "Logs",
        },
      ],
    },
  ],
});
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example_1",
  {
    location: "West US 2",
    name: "example-datadog",
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermResourceGroupExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • datadogMonitorId - (Required) The Datadog Monitor Id which should be used for this Datadog Monitor Tag Rule. Changing this forces a new Datadog Monitor Tag Rule to be created.

  • name - (Optional) The name of the Tag Rules configuration. The allowed value is default. It defaults to default.

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

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


An log block supports the following:

  • aadLogEnabled - (Optional) Whether AAD logs should be sent for the Monitor resource?

  • subscriptionLogEnabled - (Optional) Whether Azure subscription logs should be sent for the Monitor resource?

  • resourceLogEnabled - (Optional) Whether Azure resource logs should be sent for the Monitor resource?

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

NOTE: List of filtering tags to be used for capturing logs. This only takes effect if resourceLogEnabled flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags.


A metric block supports the following:

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

NOTE: List of filtering tags to be used for capturing metrics. If empty, all resources will be captured. If only Exclude action is specified, the rules will apply to the list of all available resources. If Include actions are specified, the rules will only include resources with the associated tags.


A filter block supports the following:

  • name - (Required) Name of the Tag.

  • value - (Required) Value of the Tag.

  • action - (Required) Allowed values Include or Exclude.

Timeouts

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

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

Import

Tag Rules on the Datadog Monitor can be imported using the tagRuleResourceId, e.g.

terraform import azurerm_datadog_monitor_tag_rule.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Datadog/monitors/monitor1/tagRules/default