Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

[#172432028] Add liveness_probe block in azurerm_container_group module #115

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions azurerm_container_group/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,28 @@ resource "azurerm_container_group" "container_group" {
storage_account_name = module.storage_account.resource_name
storage_account_key = module.storage_account.primary_access_key
}

dynamic "liveness_probe" {
for_each = var.container.liveness_probe == null ? [] : list(var.container.liveness_probe)

content {
exec = liveness_probe.value.exec
initial_delay_seconds = liveness_probe.value.initial_delay_seconds
period_seconds = liveness_probe.value.period_seconds
failure_threshold = liveness_probe.value.failure_threshold
success_threshold = liveness_probe.value.success_threshold
timeout_seconds = liveness_probe.value.timeout_seconds

dynamic "http_get" {
for_each = liveness_probe.value.http_get == null ? [] : list(liveness_probe.value.http_get)
content {
path = http_get.value.path
port = http_get.value.port
scheme = http_get.value.scheme
}
}
}
}
}

tags = {
Expand Down
6 changes: 3 additions & 3 deletions azurerm_container_group/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
output "id" {
value = azurerm_container_group.container_group.id
value = azurerm_container_group.container_group.id
}

output "ip_address" {
value = azurerm_container_group.container_group.ip_address
value = azurerm_container_group.container_group.ip_address
}

output "fqdn" {
value = azurerm_container_group.container_group.fqdn
value = azurerm_container_group.container_group.fqdn
}
16 changes: 16 additions & 0 deletions azurerm_container_group/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@ variable "container" {
protocol = string
}))
commands = list(string)

// Optional: use liveness_probe = null in your module.
liveness_probe = object({
exec = list(string)
initial_delay_seconds = number
period_seconds = number
failure_threshold = number
success_threshold = number
timeout_seconds = number
// Optional: use http_get = null in your module.
http_get = object({
path = string
port = number
scheme = string
})
})
})
}

Expand Down