diff --git a/_example/complete/main.tf b/_example/complete/main.tf index 62d57d6..f272ccb 100644 --- a/_example/complete/main.tf +++ b/_example/complete/main.tf @@ -27,9 +27,9 @@ module "log-analytics" { # APP Service module "windows-web-app" { - source = "../../" + source = "../../" # enable = true - count = var.enable && var.is_linux_webapp ? 0 :1 + count = var.enable && var.is_linux_webapp ? 0 : 1 name = "app" environment = "testing" label_order = ["name", "environment", ] @@ -39,9 +39,9 @@ module "windows-web-app" { os_type = var.windows_os_type sku_name = var.windows_sku_name - #log-analytics + #log-analytics log_analytics_workspace_id = module.log-analytics.workspace_id - app_insights_workspace_id = module.log-analytics.workspace_id # insights mein log analytics ki workspace id + app_insights_workspace_id = module.log-analytics.workspace_id # insights mein log analytics ki workspace id #app-service logs # app_service_logs = var.app_service_logs @@ -58,7 +58,7 @@ module "windows-web-app" { # enable_https = true site_config = { - use_32_bit_worker_process = true + use_32_bit_worker_process = true } # site_config = var.site_config @@ -67,7 +67,7 @@ module "windows-web-app" { app_settings = { - WEBSITE_NODE_DEFAULT_VERSION = "~16" + WEBSITE_NODE_DEFAULT_VERSION = "~16" # linux_fx_version = "node|18-lts" } } @@ -75,7 +75,7 @@ module "windows-web-app" { # APP Service module "linux-web-app" { - source = "../../" + source = "../../" # enable = true count = var.enable && var.is_linux_webapp ? 1 : 0 name = "app" @@ -87,9 +87,9 @@ module "linux-web-app" { os_type = var.linux_os_type sku_name = var.linux_sku_name - #log-analytics + #log-analytics log_analytics_workspace_id = module.log-analytics.workspace_id - app_insights_workspace_id = module.log-analytics.workspace_id # insights mein log analytics ki workspace id + app_insights_workspace_id = module.log-analytics.workspace_id # insights mein log analytics ki workspace id #app-service logs # app_service_logs = var.app_service_logs @@ -106,7 +106,7 @@ module "linux-web-app" { # enable_https = true site_config = { - use_32_bit_worker_process = true + use_32_bit_worker_process = true } # site_config = var.site_config @@ -115,7 +115,7 @@ module "linux-web-app" { app_settings = { - WEBSITE_NODE_DEFAULT_VERSION = "~16" + WEBSITE_NODE_DEFAULT_VERSION = "~16" # linux_fx_version = "node|18-lts" } } diff --git a/_example/complete/variables.tf b/_example/complete/variables.tf index 22a0256..9da0c61 100644 --- a/_example/complete/variables.tf +++ b/_example/complete/variables.tf @@ -1,6 +1,6 @@ # App Service Plan -variable "windows_sku_name"{ +variable "windows_sku_name" { default = "S1" } @@ -8,14 +8,14 @@ variable "windows_os_type" { default = "Windows" } -variable "linux_sku_name"{ +variable "linux_sku_name" { default = "B1" - + } variable "linux_os_type" { default = "Linux" - + } variable "enable" { diff --git a/main.tf b/main.tf index e733556..9eceb49 100644 --- a/main.tf +++ b/main.tf @@ -167,10 +167,10 @@ locals { } auth_settings_v2_login = try(var.auth_settings_v2.login, null) == null ? local.auth_settings_v2_login_default : var.auth_settings_v2.login - resource_group_name = var.resource_group_name - location = var.location - valid_rg_name = var.existing_private_dns_zone == null ? local.resource_group_name : (var.existing_private_dns_zone_resource_group_name == "" ? local.resource_group_name : var.existing_private_dns_zone_resource_group_name) - private_dns_zone_name = var.existing_private_dns_zone == null ? join("", azurerm_private_dns_zone.dnszone.*.name) : var.existing_private_dns_zone + resource_group_name = var.resource_group_name + location = var.location + valid_rg_name = var.existing_private_dns_zone == null ? local.resource_group_name : (var.existing_private_dns_zone_resource_group_name == "" ? local.resource_group_name : var.existing_private_dns_zone_resource_group_name) + private_dns_zone_name = var.existing_private_dns_zone == null ? join("", azurerm_private_dns_zone.dnszone.*.name) : var.existing_private_dns_zone } #---------------------------------------------Linux web app-----------------------------------------------------# @@ -191,7 +191,7 @@ resource "azurerm_linux_web_app" "main" { for_each = [local.site_config] content { - linux_fx_version = lookup(site_config.value, "linux_fx_version", null) # ----> Added + linux_fx_version = lookup(site_config.value, "linux_fx_version", null) # ----> Added container_registry_managed_identity_client_id = lookup(site_config.value, "container_registry_managed_identity_client_id", null) container_registry_use_managed_identity = lookup(site_config.value, "container_registry_use_managed_identity", null) @@ -497,7 +497,7 @@ resource "azurerm_linux_web_app" "main" { lifecycle { ignore_changes = [ - app_settings, + app_settings, site_config.0.application_stack, site_config.0.cors, site_config.0.ip_restriction_default_action, @@ -527,7 +527,7 @@ resource "azurerm_application_insights" "app_insights" { retention_in_days = var.retention_in_days disable_ip_masking = var.disable_ip_masking tags = module.labels.tags - workspace_id = var.app_insights_workspace_id # Added log analytics workspace id from module in main using this variable app_insights_workspace_id + workspace_id = var.app_insights_workspace_id # Added log analytics workspace id from module in main using this variable app_insights_workspace_id } #----------------------------End point ---------------------------------------------------# @@ -600,7 +600,7 @@ resource "azurerm_monitor_diagnostic_setting" "diagnostic" { count = var.enable && var.enable_diagnostic ? 1 : 0 name = format("%s-diagnostic-log", module.labels.id) target_resource_id = var.enable && var.is_linux_webapp ? azurerm_linux_web_app.main[0].id : azurerm_windows_web_app.main[0].id # Added condition for both linux and windows - log_analytics_workspace_id = var.log_analytics_workspace_id + log_analytics_workspace_id = var.log_analytics_workspace_id storage_account_id = var.storage_account_id eventhub_name = var.eventhub_name eventhub_authorization_rule_id = var.eventhub_authorization_rule_id @@ -638,7 +638,7 @@ resource "azurerm_windows_web_app" "main" { for_each = [local.site_config] content { - windows_fx_version = lookup(site_config.value, "windows_fx_version", null) # --> Added + windows_fx_version = lookup(site_config.value, "windows_fx_version", null) # --> Added container_registry_managed_identity_client_id = lookup(site_config.value, "container_registry_managed_identity_client_id", null) container_registry_use_managed_identity = lookup(site_config.value, "container_registry_use_managed_identity", null) @@ -945,7 +945,7 @@ resource "azurerm_windows_web_app" "main" { lifecycle { ignore_changes = [ - app_settings, + app_settings, site_config.0.application_stack, site_config.0.cors, site_config.0.ip_restriction_default_action, diff --git a/variables.tf b/variables.tf index 8b5701d..8c5cee5 100644 --- a/variables.tf +++ b/variables.tf @@ -376,8 +376,8 @@ variable "eventhub_authorization_rule_id" { variable "is_linux_webapp" { description = "Enable linux web app" - type = bool - default = true + type = bool + default = true } @@ -653,8 +653,8 @@ variable "integration_subnet_id" { } variable "app_insights_workspace_id" { - type = string - default = null + type = string + default = null } variable "read_permissions" {