Skip to content

A module which is used to deploy a log analytics workspace into a subscription. Alternatively, if can be used to fetch info about an existing workspace, making this module multi-purpose. Be sure to pass a provider block if you wish to perform a read on a new subscription ⭐

License

Notifications You must be signed in to change notification settings

libre-devops/terraform-azurerm-log-analytics-workspace

Repository files navigation

resource "azurerm_log_analytics_workspace" "law" {
  name                               = try(var.law_name, null)
  location                           = var.location
  resource_group_name                = var.rg_name
  allow_resource_only_permissions    = try(var.allow_resource_only_permissions, true)
  local_authentication_disabled      = try(var.local_authentication_disabled, true)
  cmk_for_query_forced               = try(var.cmk_for_query_forced, false, null)
  sku                                = title(try(var.law_sku, null))
  retention_in_days                  = try(var.retention_in_days, null)
  reservation_capacity_in_gb_per_day = var.law_sku == "CapacityReservation" ? var.reservation_capacity_in_gb_per_day : null
  daily_quota_gb                     = title(var.law_sku) == "Free" ? "0.5" : try(var.daily_quota_gb, null)
  internet_ingestion_enabled         = try(var.internet_ingestion_enabled, null)
  internet_query_enabled             = try(var.internet_query_enabled, null)
  tags                               = try(var.tags, null)
}

Requirements

No requirements.

Providers

Name Version
azurerm n/a

Modules

No modules.

Resources

Name Type
azurerm_log_analytics_workspace.law resource

Inputs

Name Description Type Default Required
allow_resource_only_permissions Whether users require permissions to resources to view logs bool true no
cmk_for_query_forced Whether or not a Customer Managed Key for the query is forced bool true no
daily_quota_gb The amount of gb set for max daily ingetion string "" no
internet_ingestion_enabled Whether internet ingestion is enabled bool null no
internet_query_enabled Whether or not your workspace can be queried from the internet bool null no
law_name The name of a log analytics workspace string n/a yes
law_sku The sku of the log analytics workspace string "" no
local_authentication_disabled Whether local authentication is enabled, defaults to false bool false no
location The location for this resource to be put in string n/a yes
reservation_capacity_in_gb_per_day The reservation capacity gb per day, can only be used with CapacityReservation SKU string "" no
retention_in_days The number of days for retention, between 7 and 730 string "" no
rg_name The name of the resource group, this module does not create a resource group, it is expecting the value of a resource group already exists string n/a yes
tags A map of the tags to use on the resources that are deployed with this module. map(string)
{
"source": "terraform"
}
no

Outputs

Name Description
law_id The id of the log analytics workspace. If a new log analytic workspace is created, fetch its data id, if one is created, fetch the remote one instead
law_name The name of the log analytics workspace
law_primary_key The primary key of the log analytics workspace. If a new log analytic workspace is created, fetch its data id, if one is created, fetch the remote one instead
law_secondary_key The primary key of the log analytics workspace. If a new log analytic workspace is created, fetch its data id, if one is created, fetch the remote one instead
law_workspace_id The workspace id of the log analytics workspace. If a new log analytic workspace is created, fetch its data id, if one is created, fetch the remote one instead

About

A module which is used to deploy a log analytics workspace into a subscription. Alternatively, if can be used to fetch info about an existing workspace, making this module multi-purpose. Be sure to pass a provider block if you wish to perform a read on a new subscription ⭐

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published