diff --git a/README.md b/README.md index 7c9dc11..a955d7e 100644 --- a/README.md +++ b/README.md @@ -252,6 +252,7 @@ Available targets: | [health\_check\_matcher](#input\_health\_check\_matcher) | The HTTP response codes to indicate a healthy check | `string` | `"200-399"` | no | | [health\_check\_path](#input\_health\_check\_path) | The destination for the health check request | `string` | `"/"` | no | | [health\_check\_port](#input\_health\_check\_port) | The port to use for the healthcheck | `string` | `"traffic-port"` | no | +| [health\_check\_protocol](#input\_health\_check\_protocol) | The protocol to use for the healthcheck. If not specified, same as the traffic protocol | `string` | `null` | no | | [health\_check\_timeout](#input\_health\_check\_timeout) | The amount of time to wait in seconds before failing a health check request | `number` | `10` | no | | [health\_check\_unhealthy\_threshold](#input\_health\_check\_unhealthy\_threshold) | The number of consecutive health check failures required before considering the target unhealthy | `number` | `2` | no | | [http2\_enabled](#input\_http2\_enabled) | A boolean flag to enable/disable HTTP/2 | `bool` | `true` | no | diff --git a/docs/terraform.md b/docs/terraform.md index bf26fc8..b3c8ee4 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -68,6 +68,7 @@ | [health\_check\_matcher](#input\_health\_check\_matcher) | The HTTP response codes to indicate a healthy check | `string` | `"200-399"` | no | | [health\_check\_path](#input\_health\_check\_path) | The destination for the health check request | `string` | `"/"` | no | | [health\_check\_port](#input\_health\_check\_port) | The port to use for the healthcheck | `string` | `"traffic-port"` | no | +| [health\_check\_protocol](#input\_health\_check\_protocol) | The protocol to use for the healthcheck. If not specified, same as the traffic protocol | `string` | `null` | no | | [health\_check\_timeout](#input\_health\_check\_timeout) | The amount of time to wait in seconds before failing a health check request | `number` | `10` | no | | [health\_check\_unhealthy\_threshold](#input\_health\_check\_unhealthy\_threshold) | The number of consecutive health check failures required before considering the target unhealthy | `number` | `2` | no | | [http2\_enabled](#input\_http2\_enabled) | A boolean flag to enable/disable HTTP/2 | `bool` | `true` | no | diff --git a/main.tf b/main.tf index f773274..4c93639 100644 --- a/main.tf +++ b/main.tf @@ -108,7 +108,7 @@ resource "aws_lb_target_group" "default" { slow_start = var.slow_start health_check { - protocol = var.target_group_protocol + protocol = var.health_check_protocol != null ? var.health_check_protocol : var.target_group_protocol path = var.health_check_path port = var.health_check_port timeout = var.health_check_timeout diff --git a/variables.tf b/variables.tf index adcaf6c..9a481f9 100644 --- a/variables.tf +++ b/variables.tf @@ -164,6 +164,12 @@ variable "health_check_port" { description = "The port to use for the healthcheck" } +variable "health_check_protocol" { + type = string + default = null + description = "The protocol to use for the healthcheck. If not specified, same as the traffic protocol" +} + variable "health_check_timeout" { type = number default = 10