Skip to content

azurermLogAnalyticsLinkedStorageAccount

Manages a Log Analytics Linked Storage Account.

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 azurermStorageAccountExample = new azurerm.storageAccount.StorageAccount(
  this,
  "example_1",
  {
    account_replication_type: "GRS",
    account_tier: "Standard",
    location: azurermResourceGroupExample.location,
    name: "examplesa",
    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.*/
azurermStorageAccountExample.overrideLogicalId("example");
const azurermLogAnalyticsWorkspaceExample =
  new azurerm.logAnalyticsWorkspace.LogAnalyticsWorkspace(this, "example_2", {
    location: azurermResourceGroupExample.location,
    name: "exampleworkspace",
    resource_group_name: azurermResourceGroupExample.name,
    sku: "PerGB2018",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermLogAnalyticsWorkspaceExample.overrideLogicalId("example");
const azurermLogAnalyticsLinkedStorageAccountExample =
  new azurerm.logAnalyticsLinkedStorageAccount.LogAnalyticsLinkedStorageAccount(
    this,
    "example_3",
    {
      data_source_type: "CustomLogs",
      resource_group_name: azurermResourceGroupExample.name,
      storage_account_ids: [azurermStorageAccountExample.id],
      workspace_resource_id: azurermLogAnalyticsWorkspaceExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermLogAnalyticsLinkedStorageAccountExample.overrideLogicalId("example");

Arguments Reference

The following arguments are supported:

  • dataSourceType - (Required) The data source type which should be used for this Log Analytics Linked Storage Account. Possible values are customLogs, azureWatson, query, ingestion and alerts. Changing this forces a new Log Analytics Linked Storage Account to be created.

Note: The dataSourceType is case-insensitive in current 3.x version. And in 4.0 or later versions, Case-sensitivity will be required.

  • resourceGroupName - (Required) The name of the Resource Group where the Log Analytics Linked Storage Account should exist. Changing this forces a new Log Analytics Linked Storage Account to be created.

  • workspaceResourceId - (Required) The resource ID of the Log Analytics Workspace. Changing this forces a new Log Analytics Linked Storage Account to be created.

  • storageAccountIds - (Required) The storage account resource ids to be linked.

Attributes Reference

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

  • id - The ID of the Log Analytics Linked Storage Account.

Timeouts

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

  • create - (Defaults to 30 minutes) Used when creating the Log Analytics Linked Storage Account.
  • read - (Defaults to 5 minutes) Used when retrieving the Log Analytics Linked Storage Account.
  • update - (Defaults to 30 minutes) Used when updating the Log Analytics Linked Storage Account.
  • delete - (Defaults to 30 minutes) Used when deleting the Log Analytics Linked Storage Account.

Import

Log Analytics Linked Storage Accounts can be imported using the resourceId, e.g.

terraform import azurerm_log_analytics_linked_storage_account.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.OperationalInsights/workspaces/workspace1/linkedStorageAccounts/{dataSourceType}