This module is based on work from Innovation Norway.
This Terraform enables the Diagnostic Settings on a given Azure resource.
Module version | Terraform version | AzureRM version |
---|---|---|
>= 5.x.x | 0.15.x & 1.0.x | >= 2.0 |
>= 4.x.x | 0.13.x | >= 2.0 |
>= 3.x.x | 0.12.x | >= 2.0 |
>= 2.x.x | 0.12.x | < 2.0 |
< 2.x.x | 0.11.x | < 2.0 |
This module is optimized to work with the Claranet terraform-wrapper tool
which set some terraform variables in the environment needed by this module.
More details about variables set by the terraform-wrapper
available in the documentation.
module "azure_region" {
source = "claranet/regions/azurerm"
version = "x.x.x"
azure_region = var.azure_region
}
module "rg" {
source = "claranet/rg/azurerm"
version = "x.x.x"
location = module.azure_region.location
client_name = var.client_name
environment = var.environment
stack = var.stack
}
module "logs" {
source = "claranet/run-common/azurerm//modules/logs"
version = "x.x.x"
client_name = var.client_name
environment = var.environment
stack = var.stack
location = module.azure_region.location
location_short = module.azure_region.location_short
resource_group_name = module.rg.resource_group_name
}
module "lb" {
source = "claranet/lb/azurerm"
version = "x.x.x"
client_name = var.client_name
environment = var.environment
location = module.azure_region.location
location_short = module.azure_region.location_short
stack = var.stack
resource_group_name = module.rg.resource_group_name
allocate_public_ip = true
enable_nat = true
}
module "diagnostic_settings" {
source = "claranet/diagnostic-settings/azurerm"
version = "x.x.x"
resource_id = module.lb.lb_id
logs_destinations_ids = [
module.logs.logs_storage_account_id,
module.logs.log_analytics_workspace_id
]
log_analytics_destination_type = "Dedicated"
}
Name | Version |
---|---|
azurecaf | ~> 1.1 |
azurerm | >= 1.31 |
No modules.
Name | Type |
---|---|
azurecaf_name.diag | resource |
azurerm_monitor_diagnostic_setting.main | resource |
azurerm_monitor_diagnostic_categories.main | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
custom_name | Name of the diagnostic settings, generated if empty. | string |
"" |
no |
log_analytics_destination_type | When set to 'Dedicated' logs sent to a Log Analytics workspace will go into resource specific tables, instead of the legacy AzureDiagnostics table. Azure Data Factory is the only compatible resource so far. | string |
"AzureDiagnostics" |
no |
log_categories | List of log categories. | list(string) |
null |
no |
logs_destinations_ids | List of destination resources IDs for logs diagnostic destination. Can be Storage Account, Log Analytics Workspace and Event Hub. No more than one of each can be set. | list(string) |
n/a | yes |
metric_categories | List of metric categories. | list(string) |
null |
no |
name_prefix | Optional prefix for the generated name | string |
"" |
no |
name_suffix | Optional suffix for the generated name | string |
"" |
no |
resource_id | The ID of the resource on which activate the diagnostic settings. | string |
n/a | yes |
retention_days | The number of days to keep diagnostic logs. | number |
30 |
no |
use_caf_naming | Use the Azure CAF naming provider to generate default resource name. custom_name override this if set. Legacy default name is used if this is set to false . |
bool |
true |
no |
Name | Description |
---|---|
diagnostic_settings_id | ID of the Diagnostic Settings. |
Azure Diagnostic settings documentation: docs.microsoft.com/en-us/azure/azure-monitor/essentials/diagnostic-settings