An open API service indexing awesome lists of open source software.

https://github.com/libre-devops/terraform-azurerm-diagnostic-settings

A module used to deploy diagnostic settings 🕵️‍♂️
https://github.com/libre-devops/terraform-azurerm-diagnostic-settings

Last synced: 2 months ago
JSON representation

A module used to deploy diagnostic settings 🕵️‍♂️

Awesome Lists containing this project

README

        

```hcl
resource "azurerm_monitor_diagnostic_setting" "diagnostic_settings" {
count = var.diagnostic_settings != null ? 1 : 0

name = local.diagnostic_setting_name
target_resource_id = var.diagnostic_settings.target_resource_id
storage_account_id = try(var.diagnostic_settings.storage_account_id, null)
eventhub_name = try(var.diagnostic_settings.eventhub_name, null)
eventhub_authorization_rule_id = try(var.diagnostic_settings.eventhub_authorization_rule_id, null)
log_analytics_workspace_id = try(var.diagnostic_settings.law_id, null)
log_analytics_destination_type = try(var.diagnostic_settings.law_destination_type, null)
partner_solution_id = try(var.diagnostic_settings.partner_solution_id, null)

dynamic "enabled_log" {
for_each = local.adjusted_enabled_log != [] ? toset(local.adjusted_enabled_log) : []
content {
category = enabled_log.value.category
category_group = try(enabled_log.value.category_group, null)
}
}

dynamic "metric" {
for_each = local.adjusted_metric != [] ? toset(local.adjusted_metric) : []
content {
category = metric.value.category
enabled = metric.value.enabled
}
}
}
```
## Requirements

No requirements.

## Providers

| Name | Version |
|------|---------|
| [azurerm](#provider\_azurerm) | n/a |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [azurerm_monitor_diagnostic_setting.diagnostic_settings](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_diagnostic_setting) | resource |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [diagnostic\_settings](#input\_diagnostic\_settings) | An object containing the diagnostic settings for a resource |

object({
diagnostic_settings_name = optional(string)
target_resource_id = string
storage_account_id = optional(string)
eventhub_name = optional(string)
eventhub_authorization_rule_id = optional(string)
law_id = optional(string)
law_destination_type = optional(string, "Dedicated")
partner_solution_id = optional(string)
enabled_log = optional(list(object({
category = optional(string)
category_group = optional(string)
})), [])
metric = optional(list(object({
category = string
enabled = optional(bool, true)
})), [])
enable_all_logs = optional(bool, false)
enable_all_metrics = optional(bool, false)
})
| n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| [diagnostic\_setting\_id](#output\_diagnostic\_setting\_id) | The ID of the diagnostic setting. |
| [diagnostic\_setting\_name](#output\_diagnostic\_setting\_name) | The name of the diagnostic setting. |
| [eventhub\_name](#output\_eventhub\_name) | The name of the Event Hub associated with the diagnostic setting. |
| [log\_analytics\_workspace\_id](#output\_log\_analytics\_workspace\_id) | The ID of the log analytics workspace associated with the diagnostic setting. |
| [storage\_account\_id](#output\_storage\_account\_id) | The ID of the storage account associated with the diagnostic setting. |
| [target\_resource\_id](#output\_target\_resource\_id) | The ID of the resource targeted by the diagnostic setting. |