diff --git a/azurerm/modules/azurerm-app-gateway/app_gateway.tf b/azurerm/modules/azurerm-app-gateway/app_gateway.tf index e266634..f463b2a 100644 --- a/azurerm/modules/azurerm-app-gateway/app_gateway.tf +++ b/azurerm/modules/azurerm-app-gateway/app_gateway.tf @@ -101,12 +101,13 @@ resource "azurerm_application_gateway" "network" { probe { name = "k8s-probe" - host = "127.0.0.1" + host = var.pick_host_name_from_backend_http_settings ? null : "127.0.0.1" protocol = "Http" interval = 15 unhealthy_threshold = 4 timeout = 15 path = "/healthz" + pick_host_name_from_backend_http_settings = var.pick_host_name_from_backend_http_settings match { status_code = ["200"] } @@ -119,6 +120,7 @@ resource "azurerm_application_gateway" "network" { protocol = "Http" request_timeout = 10 probe_name = "k8s-probe" + host_name = var.host_name } request_routing_rule { diff --git a/azurerm/modules/azurerm-app-gateway/vars.tf b/azurerm/modules/azurerm-app-gateway/vars.tf index 8fa25a8..809531a 100644 --- a/azurerm/modules/azurerm-app-gateway/vars.tf +++ b/azurerm/modules/azurerm-app-gateway/vars.tf @@ -185,3 +185,15 @@ variable "acme_email" { type = string description = "Email for Acme registration, must be a valid email" } + +variable "pick_host_name_from_backend_http_settings" { + type = bool + default = false + description = "Whether the host header should be picked from the backend HTTP settings. Defaults to false." +} + +variable "host_name" { + type = string + default = null + description = "Host header to be sent to the backend servers. Cannot be set if pick_host_name_from_backend_address is set to true" +}