Skip to content

Commit

Permalink
Merge pull request #1962 from visiativ-agora/feat/visiativ/diag-profi…
Browse files Browse the repository at this point in the history
…les-function-apps

Add diagnostic profiles on function apps
  • Loading branch information
arnaudlh authored Apr 23, 2024
2 parents a3156b8 + 7caa78c commit 074e339
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
4 changes: 3 additions & 1 deletion function_app.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
}
9 changes: 9 additions & 0 deletions modules/webapps/function_app/diagnostic.tf
Original file line number Diff line number Diff line change
@@ -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
}
8 changes: 7 additions & 1 deletion modules/webapps/function_app/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,10 @@ variable "virtual_subnets" {
}
variable "vnets" {
default = {}
}
}
variable "diagnostic_profiles" {
default = {}
}
variable "diagnostics" {
default = null
}

0 comments on commit 074e339

Please sign in to comment.