Skip to content

Commit

Permalink
Fix/diagnostic settings apps (#47)
Browse files Browse the repository at this point in the history
* Refactor function_app.tf and variables.tf to include diagnostic profiles and diagnostics

* Added app insight app services
Added diagnostics app services

* fixed variables
  • Loading branch information
kevindelmont authored Dec 11, 2024
1 parent cbfc1eb commit cf144d3
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app_services.tf
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ module "windows_web_apps" {
location = try(local.global_settings.regions[each.value.region], null)
azuread_applications = local.combined_objects_azuread_applications
azuread_service_principal_passwords = local.combined_objects_azuread_service_principal_passwords
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
}

output "windows_web_apps" {
Expand Down Expand Up @@ -112,6 +115,9 @@ module "linux_web_apps" {
location = try(local.global_settings.regions[each.value.region], null)
azuread_applications = local.combined_objects_azuread_applications
azuread_service_principal_passwords = local.combined_objects_azuread_service_principal_passwords
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
}
output "linux_web_apps" {
value = module.linux_web_apps
Expand Down
4 changes: 4 additions & 0 deletions function_app.tf
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ module "windows_function_apps" {
storage_account_name = try(data.azurerm_storage_account.windows_function_apps[each.key].name, null)
storage_account_access_key = try(data.azurerm_storage_account.windows_function_apps[each.key].primary_access_key, null)
tags = try(each.value.tags, null)
diagnostic_profiles = try(each.value.diagnostic_profiles, null)
diagnostics = local.combined_diagnostics
# subnet_id = try(
# each.value.subnet_id,
# local.combined_objects_networking[try(each.value.settings.lz_key, local.client_config.landingzone_key)][each.value.settings.vnet_key].subnets[each.value.settings.subnet_key].id,
Expand Down Expand Up @@ -122,6 +124,8 @@ module "linux_function_apps" {
storage_account_name = try(data.azurerm_storage_account.linux_function_apps[each.key].name, null)
storage_account_access_key = try(data.azurerm_storage_account.linux_function_apps[each.key].primary_access_key, null)
tags = try(each.value.tags, null)
diagnostic_profiles = try(each.value.diagnostic_profiles, null)
diagnostics = local.combined_diagnostics
# subnet_id = try(
# each.value.subnet_id,
# local.combined_objects_networking[try(each.value.settings.lz_key, local.client_config.landingzone_key)][each.value.settings.vnet_key].subnets[each.value.settings.subnet_key].id,
Expand Down
9 changes: 9 additions & 0 deletions modules/webapps/linux_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_linux_function_app.linux_function_app.id
resource_location = local.location
diagnostics = var.diagnostics
profiles = var.diagnostic_profiles
}
8 changes: 8 additions & 0 deletions modules/webapps/linux_function_app/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,12 @@ variable "storage_account_access_key" {

variable "dynamic_app_settings" {
default = {}
}

variable "diagnostic_profiles" {
default = {}
}

variable "diagnostics" {
default = null
}
9 changes: 9 additions & 0 deletions modules/webapps/linux_webapps/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_linux_web_app.linux_web_apps.id
resource_location = local.location
diagnostics = var.diagnostics
profiles = var.diagnostic_profiles
}
9 changes: 9 additions & 0 deletions modules/webapps/windows_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_windows_function_app.windows_function_app.id
resource_location = local.location
diagnostics = var.diagnostics
profiles = var.diagnostic_profiles
}
8 changes: 8 additions & 0 deletions modules/webapps/windows_function_app/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,12 @@ variable "storage_account_access_key" {

variable "dynamic_app_settings" {
default = {}
}

variable "diagnostic_profiles" {
default = {}
}

variable "diagnostics" {
default = null
}
9 changes: 9 additions & 0 deletions modules/webapps/windows_webapps/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_windows_web_app.windows_web_apps.id
resource_location = local.location
diagnostics = var.diagnostics
profiles = var.diagnostic_profiles
}

0 comments on commit cf144d3

Please sign in to comment.