https://github.com/libre-devops/terraform-azurerm-log-analytics-workspace
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 :star:
https://github.com/libre-devops/terraform-azurerm-log-analytics-workspace
azure azurerm azurerm-terraform-provider module terraform terraform-module
Last synced: about 1 month ago
JSON representation
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 :star:
- Host: GitHub
- URL: https://github.com/libre-devops/terraform-azurerm-log-analytics-workspace
- Owner: libre-devops
- License: mit
- Created: 2022-05-11T16:07:53.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-09-19T23:53:25.000Z (over 1 year ago)
- Last Synced: 2026-03-01T22:40:33.827Z (3 months ago)
- Topics: azure, azurerm, azurerm-terraform-provider, module, terraform, terraform-module
- Language: PowerShell
- Homepage:
- Size: 25.4 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
```hcl
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](#provider\_azurerm) | n/a |
## Modules
No modules.
## Resources
| Name | Type |
|------|------|
| [azurerm_log_analytics_workspace.law](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/log_analytics_workspace) | resource |
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [allow\_resource\_only\_permissions](#input\_allow\_resource\_only\_permissions) | Whether users require permissions to resources to view logs | `bool` | `true` | no |
| [cmk\_for\_query\_forced](#input\_cmk\_for\_query\_forced) | Whether or not a Customer Managed Key for the query is forced | `bool` | `true` | no |
| [daily\_quota\_gb](#input\_daily\_quota\_gb) | The amount of gb set for max daily ingetion | `string` | `""` | no |
| [internet\_ingestion\_enabled](#input\_internet\_ingestion\_enabled) | Whether internet ingestion is enabled | `bool` | `null` | no |
| [internet\_query\_enabled](#input\_internet\_query\_enabled) | Whether or not your workspace can be queried from the internet | `bool` | `null` | no |
| [law\_name](#input\_law\_name) | The name of a log analytics workspace | `string` | n/a | yes |
| [law\_sku](#input\_law\_sku) | The sku of the log analytics workspace | `string` | `""` | no |
| [local\_authentication\_disabled](#input\_local\_authentication\_disabled) | Whether local authentication is enabled, defaults to false | `bool` | `false` | no |
| [location](#input\_location) | The location for this resource to be put in | `string` | n/a | yes |
| [reservation\_capacity\_in\_gb\_per\_day](#input\_reservation\_capacity\_in\_gb\_per\_day) | The reservation capacity gb per day, can only be used with CapacityReservation SKU | `string` | `""` | no |
| [retention\_in\_days](#input\_retention\_in\_days) | The number of days for retention, between 7 and 730 | `string` | `""` | no |
| [rg\_name](#input\_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](#input\_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](#output\_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](#output\_law\_name) | The name of the log analytics workspace |
| [law\_primary\_key](#output\_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](#output\_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](#output\_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 |