Skip to content

Fork of the `terraform-azurerm-diagnostic-settings` module with Claranet's contributions and improvements.

License

Notifications You must be signed in to change notification settings

claranet/terraform-azurerm-diagnostic-settings

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure Diagnostic Settings

Changelog Notice Apache V2 License OpenTofu Registry

This module is based on work from Innovation Norway.

This Terraform enables the Diagnostic Settings on a given Azure resource.

Note for EventHub usage in destination

If you want to specify an Azure EventHub to send logs and metrics to in logs_destinations_ids, you need to provide a formated string with both the EventHub Namespace authorization send ID and the EventHub name (name of the queue to use in the Namespace) separated by the | character.

Please refer to the example below for a detailed implementation.

Global versioning rule for Claranet Azure modules

Module version Terraform version OpenTofu version AzureRM version
>= 8.x.x Unverified 1.8.x >= 4.0
>= 7.x.x 1.3.x >= 3.0
>= 6.x.x 1.x >= 3.0
>= 5.x.x 0.15.x >= 2.0
>= 4.x.x 0.13.x / 0.14.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

Contributing

If you want to contribute to this repository, feel free to use our pre-commit git hook configuration which will help you automatically update and format some files for you by enforcing our Terraform code module best-practices.

More details are available in the CONTRIBUTING.md file.

Usage

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.

⚠️ Since modules version v8.0.0, we do not maintain/check anymore the compatibility with Hashicorp Terraform. Instead, we recommend to use OpenTofu.

resource "azurerm_lb" "lb" {
  location            = module.azure_region.location
  name                = "lb"
  resource_group_name = module.rg.name
}

module "diagnostic_settings" {
  source  = "claranet/diagnostic-settings/azurerm"
  version = "x.x.x"

  resource_id = azurerm_lb.lb.id

  logs_destinations_ids = [
    azurerm_log_analytics_workspace.log_workspace.id
  ]

  log_analytics_destination_type = "Dedicated"
}

Providers

Name Version
azurecaf ~> 1.2.28
azurerm ~> 4.0

Modules

No modules.

Resources

Name Type
azurerm_monitor_diagnostic_setting.main resource
azurecaf_name.diag data source
azurerm_monitor_diagnostic_categories.main data source

Inputs

Name Description Type Default Required
custom_name Name of the diagnostic settings, generated if empty. string "" no
excluded_log_categories List of log categories to exclude. list(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. string "AzureDiagnostics" no
log_categories List of log categories. Defaults to all available. 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.
If you want to use Azure EventHub as a destination, you must provide a formatted string containing both the EventHub Namespace authorization send ID and the EventHub name (name of the queue to use in the Namespace) separated by the | character.
list(string) n/a yes
metric_categories List of metric categories. Defaults to all available. 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

Outputs

Name Description
id ID of the Diagnostic Settings.
resource Diagnostic settings resource output.

Related documentation

Azure Diagnostic settings documentation: docs.microsoft.com/en-us/azure/azure-monitor/essentials/diagnostic-settings

About

Fork of the `terraform-azurerm-diagnostic-settings` module with Claranet's contributions and improvements.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HCL 100.0%