Adds log analytics logging to cdn module

This commit is contained in:
Rob Gil 2020-01-29 11:34:45 -05:00
parent ffb29d45fc
commit 211a9e7875
3 changed files with 17 additions and 0 deletions

View File

@ -29,3 +29,15 @@ resource "azurerm_cdn_endpoint" "cdn" {
host_name = var.origin_host_name
}
}
resource "azurerm_monitor_diagnostic_setting" "acr_diagnostic" {
name = "${var.name}-${var.environment}-acr-diag"
target_resource_id = azurerm_cdn_endpoint.cdn.id
log_analytics_workspace_id = var.workspace_id
log {
category = "CoreAnalytics"
retention_policy {
enabled = true
}
}
}

View File

@ -29,3 +29,7 @@ variable "origin_host_name" {
description = "Subdomain to use for the origin in requests to the CDN"
}
variable "workspace_id" {
description = "Log Analytics Workspace ID for sending logs generated by this resource"
type = string
}

View File

@ -5,4 +5,5 @@ module "cdn" {
environment = var.environment
name = var.name
region = var.region
workspace_id = module.logs.workspace_id
}