diff --git a/aws/alb/README.md b/aws/alb/README.md index 43f9475..00c0501 100644 --- a/aws/alb/README.md +++ b/aws/alb/README.md @@ -22,6 +22,14 @@ groups for traffic and a default target group. - `protocol` - Target group listening protocol. Default: `http` - `access_logs_enabled` - Whether or not to enable logging. Default: `false` - `access_logs_bucket` - S3 bucket to store logs. Default: `""` + - `health_check_interval` - Default: `30` + - `health_check_path` - Default: `/` + - `health_check_port` - Default: `traffic-port` + - `health_check_protocol` - Default: `HTTP` + - `health_check_timeout` - Default: `5` + - `healthy_threshold` - Default: `5` + - `unhealthy_threshold` - Default: `2` + - `health_check_status_codes` - Default: `200`, separate multiple values with comma, ex: `200,204` ## Outputs diff --git a/aws/alb/main.tf b/aws/alb/main.tf index a5f04a7..81febf7 100644 --- a/aws/alb/main.tf +++ b/aws/alb/main.tf @@ -22,6 +22,17 @@ resource "aws_alb_target_group" "default" { port = "${var.port}" protocol = "${var.protocol}" vpc_id = "${var.vpc_id}" + + health_check { + interval = "${var.health_check_interval}" + path = "${var.health_check_path}" + port = "${var.health_check_port}" + protocol = "${var.health_check_protocol}" + timeout = "${var.health_check_timeout}" + healthy_threshold = "${var.healthy_threshold}" + unhealthy_threshold = "${var.unhealthy_threshold}" + matcher = "${var.health_check_status_codes}" + } } /* diff --git a/aws/alb/vars.tf b/aws/alb/vars.tf index 4696f94..d1ce448 100644 --- a/aws/alb/vars.tf +++ b/aws/alb/vars.tf @@ -49,8 +49,8 @@ variable "access_logs_bucket" { } variable "alb_name" { - type = "string" - default = "" + type = "string" + default = "" description = "Manual override for ALB name (which is otherwise assembled from other given data)" } @@ -65,7 +65,39 @@ variable "ssl_policy" { } variable "tg_name" { - type = "string" - default = "" + type = "string" + default = "" description = "Manual override for ALB Target Group name (which is otherwise assembled from other given data)" } + +variable "health_check_interval" { + default = "30" +} + +variable "health_check_path" { + default = "/" +} + +variable "health_check_port" { + default = "traffic-port" +} + +variable "health_check_protocol" { + default = "HTTP" +} + +variable "health_check_timeout" { + default = "5" +} + +variable "healthy_threshold" { + default = "5" +} + +variable "unhealthy_threshold" { + default = "2" +} + +variable "health_check_status_codes" { + default = "200" +}