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 🕵️♂️
- Host: GitHub
- URL: https://github.com/libre-devops/terraform-azurerm-diagnostic-settings
- Owner: libre-devops
- License: mit
- Created: 2024-02-15T10:44:11.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-09T15:59:21.000Z (8 months ago)
- Last Synced: 2024-12-26T16:11:46.902Z (4 months ago)
- Language: PowerShell
- Size: 29.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
```hcl
resource "azurerm_monitor_diagnostic_setting" "diagnostic_settings" {
count = var.diagnostic_settings != null ? 1 : 0name = 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
}
}
}
```
## RequirementsNo 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({| n/a | yes |
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)
})## 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. |