We’re using azurerm to manage our app services and associated slots. Our goal is to enable the health check on the prod slot and leaving it disabled on our staging slot. The issue is that the health check settings are being swapped after each deployment. We thought we could use lifecycle.ignore_changes to prevent swapping those values, but it’s not working.
Any insight appreciated.
resource “azurerm_app_service” “coverage_determination_service” {
name = local.service_name
location = local.location
resource_group_name = var.resource_group_name_linux[terraform.workspace]
app_service_plan_id = var.app_service_plan_id[terraform.workspace]
https_only = true
site_config {
linux_fx_version = “DOCKER|${local.container_registry_name}.azurecr.io/ucx/coverage_determination_service:latest”
always_on = true
health_check_path = “/health”
}
app_settings = {
“DOCKER_ENABLE_CI” = “false”,
“WEBSITES_ENABLE_APP_SERVICE_STORAGE” = “false”,
“DOCKER_REGISTRY_SERVER_URL” = “DockerRegistryServerUrl”,
“DOCKER_REGISTRY_SERVER_USERNAME” = “DockerRegistryServerUsername”,
“DOCKER_REGISTRY_SERVER_PASSWORD” = “DockerRegistryServerPassword”
“ApplicationInsights__InstrumentationKey” = “AppInsightsKey”
}
logs {
http_logs {
file_system {
retention_in_days = 7
retention_in_mb = 35
}
}
}
lifecycle {
ignore_changes = [
tags,
app_settings[“DOCKER_ENABLE_CI”],
site_config[“health_check_path”]
]
}
identity {
type = “SystemAssigned”
}
}
resource “azurerm_app_service_slot” “coverage_determination_service_staging_slot” {
name = local.service_staging_slot_name
app_service_name = local.service_name
location = local.location
resource_group_name = var.resource_group_name_linux[terraform.workspace]
app_service_plan_id = var.app_service_plan_id[terraform.workspace]
depends_on = [
azurerm_app_service.coverage_determination_service,
]
site_config {
linux_fx_version = “DOCKER|${local.container_registry_name}.azurecr.io/ucx/coverage_determination_service:latest”
}
app_settings = {
“WEBSITES_ENABLE_APP_SERVICE_STORAGE” : “false”,
“DOCKER_ENABLE_CI” : “true”,
“DOCKER_REGISTRY_SERVER_URL” : “https://${local.container_registry_name}.azurecr.io”,
“DOCKER_REGISTRY_SERVER_USERNAME” : local.container_registry_name,
“DOCKER_REGISTRY_SERVER_PASSWORD” : “DockerRegistryServerPassword”
“ApplicationInsights__InstrumentationKey” : “AppInsightsKey”
}
lifecycle {
ignore_changes = [
tags,
app_settings[“DOCKER_ENABLE_CI”],
site_config[“health_check_path”]
]
}
}