diff --git a/function_app.tf b/function_app.tf index ff61c6fe57..991270f463 100644 --- a/function_app.tf +++ b/function_app.tf @@ -11,6 +11,8 @@ module "function_apps" { app_service_plan_id = can(each.value.app_service_plan_id) || can(each.value.app_service_plan_key) == false ? try(each.value.app_service_plan_id, null) : local.combined_objects_app_service_plans[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.app_service_plan_key].id settings = each.value.settings application_insight = try(each.value.application_insight_key, null) == null ? null : module.azurerm_application_insights[each.value.application_insight_key] + diagnostic_profiles = try(each.value.diagnostic_profiles, null) + diagnostics = local.combined_diagnostics identity = try(each.value.identity, null) connection_strings = try(each.value.connection_strings, {}) storage_account_name = try(data.azurerm_storage_account.function_apps[each.key].name, null) @@ -48,4 +50,4 @@ data "azurerm_storage_account" "function_apps" { name = local.combined_objects_storage_accounts[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.storage_account_key].name resource_group_name = local.combined_objects_storage_accounts[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.storage_account_key].resource_group_name -} \ No newline at end of file +} diff --git a/modules/webapps/function_app/diagnostic.tf b/modules/webapps/function_app/diagnostic.tf new file mode 100644 index 0000000000..981bd0dd3a --- /dev/null +++ b/modules/webapps/function_app/diagnostic.tf @@ -0,0 +1,9 @@ +module "diagnostics" { + source = "../../diagnostics" + count = var.diagnostic_profiles == null ? 0 : 1 + + resource_id = azurerm_function_app.function_app.id + resource_location = local.location + diagnostics = var.diagnostics + profiles = var.diagnostic_profiles +} diff --git a/modules/webapps/function_app/variables.tf b/modules/webapps/function_app/variables.tf index 713ad444b1..b3fb6425cc 100644 --- a/modules/webapps/function_app/variables.tf +++ b/modules/webapps/function_app/variables.tf @@ -86,4 +86,10 @@ variable "virtual_subnets" { } variable "vnets" { default = {} -} \ No newline at end of file +} +variable "diagnostic_profiles" { + default = {} +} +variable "diagnostics" { + default = null +}