Skip to content

Commit e986fbd

Browse files
authored
Merge pull request #3 from scimma/feature/generalized-http-check-headers
Make healthcheck headers configurable
2 parents 54c8669 + 7e958a9 commit e986fbd

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

main.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ resource "kubernetes_deployment" "deployment" {
7171
path = var.healthcheck_path
7272
port = 80
7373

74+
dynamic "httpHeaders" {
75+
for_each = var.healthcheck_headers
76+
iterator = header
77+
content {
78+
name = header.value["name"]
79+
value = header.value["value"]
80+
}
81+
}
82+
7483
}
7584
period_seconds = 10
7685
initial_delay_seconds = 15

variables.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,19 @@ EOT
3333
type = string
3434
}
3535

36+
variable "healthcheck_headers" {
37+
type = list(object({
38+
name = string
39+
value = string
40+
}))
41+
default = []
42+
description = <<EOT
43+
HTTP headers to be set on healthcheck requests.
44+
See https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#http-probes
45+
for documentation, including the default headers.
46+
EOT
47+
}
48+
3649
variable "env_vars" {
3750
type = list(object({
3851
name = string

0 commit comments

Comments
 (0)