Skip to content

Commit

Permalink
tf: support advanced health check parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
digorgonzola committed Dec 19, 2023
1 parent 38de6e8 commit dae6955
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
7 changes: 5 additions & 2 deletions deploy/tf/alb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ resource "aws_lb_target_group" "app" {
vpc_id = local.vpc_id

health_check {
enabled = true
path = var.health_check_path
enabled = true
path = var.health_check_path
healthy_threshold = var.healthy_threshold != null ? var.healthy_threshold : null
interval = var.interval != null ? var.interval : null
unhealthy_threshold = var.unhealthy_threshold != null ? var.unhealthy_threshold : null
}
}

Expand Down
31 changes: 25 additions & 6 deletions deploy/tf/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ variable "environment" {
type = string
}

variable "health_check_path" {
description = "The health check path for the ALB target group."
type = string
default = "/health"
}

variable "iam_statements" {
description = "List of IAM statements to attach to the task role"
type = any
Expand Down Expand Up @@ -104,3 +98,28 @@ variable "proxy_port" {
type = number
default = 80
}

# Target group health checks
variable "health_check_path" {
description = "The health check path for the ALB target group."
type = string
default = "/health"
}

variable "healthy_threshold" {
description = "Number of consecutive health check successes required before considering a target healthy. The range is 2-10."
type = number
default = null
}

variable "interval" {
description = "The amount of time in seconds between health checks."
type = number
default = null
}

variable "unhealthy_threshold" {
description = "Number of consecutive health check failures required before considering a target unhealthy. The range is 2-10."
type = number
default = null
}

0 comments on commit dae6955

Please sign in to comment.