File tree Expand file tree Collapse file tree 3 files changed +32
-3
lines changed
Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,20 @@ resource "azurerm_container_app" "main" {
103103 secret_name = lower (env. value . name )
104104 }
105105 }
106+
107+ dynamic "liveness_probe" {
108+ for_each = local. probe_enabled ? [1 ] : []
109+
110+ content {
111+ transport = " HTTP"
112+ path = var. probe_path
113+ port = local. effective_liveness_port
114+ initial_delay = 45
115+ interval_seconds = 10
116+ timeout = 2
117+ failure_count_threshold = 4
118+ }
119+ }
106120 }
107121 min_replicas = var. min_replicas
108122 }
@@ -145,6 +159,7 @@ resource "azurerm_container_app" "main" {
145159 }
146160 }
147161 }
162+
148163}
149164
150165# Enable Microsoft Entra ID authentication if specified
Original file line number Diff line number Diff line change @@ -93,6 +93,12 @@ variable "exposed_port" {
9393 default = null
9494}
9595
96+ variable "liveness_probe_port" {
97+ description = " Port for the liveness probe to check. Default is var.port."
98+ type = number
99+ default = null
100+ }
101+
96102variable "memory" {
97103 description = " Memory allocated to the app (GiB). Also dictates the CPU allocation: CPU(%)=MEMORY(Gi)/2. Maximum: 4Gi"
98104 default = " 0.5"
@@ -190,6 +196,12 @@ variable "replica_restart_alert_threshold" {
190196 default = 1
191197}
192198
199+ variable "probe_path" {
200+ description = " Path for the liveness probe. If null, liveness probe is disabled."
201+ type = string
202+ default = null
203+ }
204+
193205locals {
194206 memory = " ${ var . memory } Gi"
195207 cpu = var. memory / 2
@@ -202,5 +214,7 @@ locals {
202214 PT6H = " PT5M"
203215 PT12H = " PT5M"
204216 }
205- alert_frequency = local. alert_frequency_map [var . alert_window_size ]
217+ alert_frequency = local. alert_frequency_map [var . alert_window_size ]
218+ probe_enabled = var. probe_path != null
219+ effective_liveness_port = var. liveness_probe_port != null ? var. liveness_probe_port : var. port
206220}
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ variable "tags" {
2424}
2525
2626variable "dashboard_properties" {
27- type = string
28- default = " {}"
27+ type = string
28+ default = " {}"
2929 description = " JSON data representing dashboard body. See above for details on how to obtain this from the Portal."
3030}
You can’t perform that action at this time.
0 commit comments