Skip to content

Commit

Permalink
Add health_check_path to allow the health check to use a port other t…
Browse files Browse the repository at this point in the history
…han traffic-port (#63)

## what
* Allows the specification of a health check port that is not the traffic-port.

## why
* The health check endpoint doesn't necessarily always exist on the default traffic-port, as is my case.
  • Loading branch information
msmagoo87 authored Nov 24, 2020
1 parent c53efef commit 5d26d6c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ Available targets:
| health\_check\_interval | The duration in seconds in between health checks | `number` | `15` | no |
| health\_check\_matcher | The HTTP response codes to indicate a healthy check | `string` | `"200-399"` | no |
| health\_check\_path | The destination for the health check request | `string` | `"/"` | no |
| health\_check\_port | The port to use for the healthcheck | `string` | `"traffic-port"` | no |
| health\_check\_timeout | The amount of time to wait in seconds before failing a health check request | `number` | `10` | no |
| health\_check\_unhealthy\_threshold | The number of consecutive health check failures required before considering the target unhealthy | `number` | `2` | no |
| http2\_enabled | A boolean flag to enable/disable HTTP/2 | `bool` | `true` | no |
Expand Down
1 change: 1 addition & 0 deletions docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
| health\_check\_interval | The duration in seconds in between health checks | `number` | `15` | no |
| health\_check\_matcher | The HTTP response codes to indicate a healthy check | `string` | `"200-399"` | no |
| health\_check\_path | The destination for the health check request | `string` | `"/"` | no |
| health\_check\_port | The port to use for the healthcheck | `string` | `"traffic-port"` | no |
| health\_check\_timeout | The amount of time to wait in seconds before failing a health check request | `number` | `10` | no |
| health\_check\_unhealthy\_threshold | The number of consecutive health check failures required before considering the target unhealthy | `number` | `2` | no |
| http2\_enabled | A boolean flag to enable/disable HTTP/2 | `bool` | `true` | no |
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ resource "aws_lb_target_group" "default" {
health_check {
protocol = var.target_group_protocol
path = var.health_check_path
port = var.health_check_port
timeout = var.health_check_timeout
healthy_threshold = var.health_check_healthy_threshold
unhealthy_threshold = var.health_check_unhealthy_threshold
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ variable "health_check_path" {
description = "The destination for the health check request"
}

variable "health_check_port" {
type = string
default = "traffic-port"
description = "The port to use for the healthcheck"
}

variable "health_check_timeout" {
type = number
default = 10
Expand Down

0 comments on commit 5d26d6c

Please sign in to comment.