azurermLogAnalyticsWorkspace
Manages a Log Analytics (formally Operational Insights) Workspace.
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 azurermLogAnalyticsWorkspaceExample =
new azurerm.logAnalyticsWorkspace.LogAnalyticsWorkspace(this, "example_1", {
location: azurermResourceGroupExample.location,
name: "acctest-01",
resource_group_name: azurermResourceGroupExample.name,
retention_in_days: 30,
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");
Argument Reference
The following arguments are supported:
-
name
- (Required) Specifies the name of the Log Analytics Workspace. Workspace name should include 4-63 letters, digits or '-'. The '-' shouldn't be the first or the last symbol. Changing this forces a new resource to be created. -
resourceGroupName
- (Required) The name of the resource group in which the Log Analytics workspace is created. Changing this forces a new resource to be created. -
location
- (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. -
allowResourceOnlyPermissions
- (Optional) Specifies if the log Analytics Workspace allow users accessing to data associated with resources they have permission to view, without permission to workspace. Defaults totrue
. -
localAuthenticationDisabled
- (Optional) Specifies if the log Analytics workspace should enforce authentication using Azure AD. Defaults tofalse
. -
sku
- (Optional) Specifies the SKU of the Log Analytics Workspace. Possible values arefree
,perNode
,premium
,standard
,standalone
,unlimited
,capacityReservation
, andperGb2018
(new SKU as of20180403
). Defaults toperGb2018
.
\~> NOTE: A new pricing model took effect on 20180403
, which requires the SKU perGb2018
. If you're provisioned resources before this date you have the option of remaining with the previous Pricing SKU and using the other SKUs defined above. More information about the Pricing SKUs is available at the following URI.
\~> NOTE: The free
SKU has a default dailyQuotaGb
value of 05
(GB).
-
retentionInDays
- (Optional) The workspace data retention in days. Possible values are either 7 (Free Tier only) or range between 30 and 730. -
dailyQuotaGb
- (Optional) The workspace daily quota for ingestion in GB. Defaults to -1 (unlimited) if omitted.
\~> NOTE: When sku
is set to free
this field should not be set and has a default value of 05
.
-
cmkForQueryForced
- (Optional) Is Customer Managed Storage mandatory for query management? -
internetIngestionEnabled
- (Optional) Should the Log Analytics Workspace support ingestion over the Public Internet? Defaults totrue
. -
internetQueryEnabled
- (Optional) Should the Log Analytics Workspace support querying over the Public Internet? Defaults totrue
. -
reservationCapacityInGbPerDay
- (Optional) The capacity reservation level in GB for this workspace. Must be in increments of 100 between 100 and 5000.
\~> NOTE: reservationCapacityInGbPerDay
can only be used when the sku
is set to capacityReservation
.
tags
- (Optional) A mapping of tags to assign to the resource.
\~> NOTE: If a azurermLogAnalyticsWorkspace
is connected to a azurermLogAnalyticsCluster
via a azurermLogAnalyticsLinkedService
you will not be able to modify the workspaces sku
field until the link between the workspace and the cluster has been broken by deleting the azurermLogAnalyticsLinkedService
resource. All other fields are modifiable while the workspace is linked to a cluster.
Attributes Reference
The following attributes are exported:
-
id
- The Log Analytics Workspace ID. -
primarySharedKey
- The Primary shared key for the Log Analytics Workspace. -
secondarySharedKey
- The Secondary shared key for the Log Analytics Workspace. -
workspaceId
- The Workspace (or Customer) ID for the Log Analytics Workspace.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Log Analytics Workspace.update
- (Defaults to 30 minutes) Used when updating the Log Analytics Workspace.read
- (Defaults to 5 minutes) Used when retrieving the Log Analytics Workspace.delete
- (Defaults to 30 minutes) Used when deleting the Log Analytics Workspace.
Import
Log Analytics Workspaces can be imported using the resourceId
, e.g.