Skip to content

azurermLogzSubAccountTagRule

Manages a Logz Sub Account Tag 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: "example-logz",
  }
);
const azurermLogzMonitorExample = new azurerm.logzMonitor.LogzMonitor(
  this,
  "example_1",
  {
    location: azurermResourceGroupExample.location,
    name: "example-monitor",
    plan: [
      {
        billing_cycle: "MONTHLY",
        effective_date: "2022-06-06T00:00:00Z",
        usage_type: "COMMITTED",
      },
    ],
    resource_group_name: azurermResourceGroupExample.name,
    user: [
      {
        email: "user@example.com",
        first_name: "Example",
        last_name: "User",
        phone_number: "+12313803556",
      },
    ],
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermLogzMonitorExample.overrideLogicalId("example");
const azurermLogzSubAccountExample = new azurerm.logzSubAccount.LogzSubAccount(
  this,
  "example_2",
  {
    logz_monitor_id: azurermLogzMonitorExample.id,
    name: "example-subaccount",
    user: [
      {
        email: `\${${azurermLogzMonitorExample.user.fqn}[0].email}`,
        first_name: `\${${azurermLogzMonitorExample.user.fqn}[0].first_name}`,
        last_name: `\${${azurermLogzMonitorExample.user.fqn}[0].last_name}`,
        phone_number: `\${${azurermLogzMonitorExample.user.fqn}[0].phone_number}`,
      },
    ],
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermLogzSubAccountExample.overrideLogicalId("example");
const azurermLogzSubAccountTagRuleExample =
  new azurerm.logzSubAccountTagRule.LogzSubAccountTagRule(this, "example_3", {
    logz_sub_account_id: azurermLogzSubAccountExample.id,
    send_aad_logs: true,
    send_activity_logs: true,
    send_subscription_logs: true,
    tag_filter: [
      {
        action: "Include",
        name: "name1",
        value: "value1",
      },
      {
        action: "Exclude",
        name: "name2",
        value: "value2",
      },
    ],
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermLogzSubAccountTagRuleExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • logzSubAccountId - (Required) The ID of the Logz Sub Account. Changing this forces a new Logz Sub Account Tag Rule to be created.

  • tagFilter - (Optional) One or more (up to 10) tagFilter blocks as defined below.

  • sendAadLogs - (Optional) Whether AAD logs should be sent to the Monitor resource?

  • sendActivityLogs - (Optional) Whether activity logs from this Logz Sub Account Tag Rule should be sent to the Monitor resource?

  • sendSubscriptionLogs - (Optional) Whether subscription logs should be sent to the Monitor resource?


An tagFilter block exports the following:

  • name - (Required) The name of the tag to match.

  • action - (Required) The action is used to limit logs collection to include or exclude Azure resources with specific tags. Possible values are include and exclude. Note that the exclude takes priority over the include.

  • value - (Optional) The value of the tag to match.

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

  • id - The ID of the Logz Sub Account Tag Rule.

Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the Logz Sub Account Tag Rule.
  • read - (Defaults to 5 minutes) Used when retrieving the Logz Sub Account Tag Rule.
  • update - (Defaults to 30 minutes) Used when updating the Logz Sub Account Tag Rule.
  • delete - (Defaults to 30 minutes) Used when deleting the Logz Sub Account Tag Rule.

Import

Logz Sub Account Tag Rules can be imported using the resourceId, e.g.

terraform import azurerm_logz_sub_account_tag_rule.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Logz/monitors/monitor1/accounts/subAccount1/tagRules/ruleSet1