Skip to main content
View SourceRelease Notes

Load Balancer Target Group Module

This module can be used to create a Target Group and Listener Rules for an Application Load Balancer created with the alb module.

The reason the load-balancer-alb-target-group module is separate is that you may wish to create multiple target groups for a single load balancer.

See the examples folder for fully working sample code.

Reference

Required

health_check_pathstringrequired

The path to use for health check requests.

The starting priority for the Listener Rules

portnumberrequired

The port the servers are listening on for requests.

target_group_namestringrequired

The name to use for the Target Group

using_server_groupboolrequired

Whether we're using an ASG or Gruntwork's Server Group module. If using ASG, then asg_name must be specified. Otherwise leave it blank

vpc_idstringrequired

The ID of the VPC in which to deploy the Target Group

Optional

asg_namestringoptional

The name of the ASG (ASG) in the servers are deployed. Leave this blank if using with a Server Group

null
deregistration_delaynumberoptional

The amount time for the Load Balancer to wait before changing the state of a deregistering server from draining to unused. The range is 0-3600 seconds.

300
enable_stickinessbooloptional

Set to true to enable stickiness, so a given user always gets routed to the same server. We recommend enabling this for the Couchbase Web Console.

false

The number of times the health check must pass before a server is considered healthy.

2
health_check_intervalnumberoptional

The approximate amount of time, in seconds, between health checks of each server. Minimum value 5 seconds, Maximum value 300 seconds.

30
health_check_matcherstringoptional

The HTTP codes to use when checking for a successful response from a server. You can specify multiple comma-separated values (for example, '200,202') or a range of values (for example, '200-299').

"200"
health_check_timeoutnumberoptional

The amount of time, in seconds, during which no response from a server means a failed health check. Must be between 2 and 60 seconds.

5

The number of times the health check must fail before a server is considered unhealthy.

2
http_listener_arnslist(string)optional

The HTTP ARNs of ALB listeners to which Listener Rules that route to this Target Group should be added.

[]
https_listener_arnslist(string)optional

The HTTPS ARNs of ALB listeners to which Listener Rules that route to this Target Group should be added.

[]

The number of HTTP ARNs in listener_arns. We should be able to compute this automatically, but due to a Terraform limitation, if there are any dynamic resources in listener_arns, then we won't be able to: https://github.com/hashicorp/terraform/pull/11482

0

The number of HTTPS ARNs in listener_arns. We should be able to compute this automatically, but due to a Terraform limitation, if there are any dynamic resources in listener_arns, then we won't be able to: https://github.com/hashicorp/terraform/pull/11482

0
protocolstringoptional

The protocol to use to talk to the servers. Must be one of: HTTP, HTTPS.

"HTTP"
routing_conditionlist(object(…))optional

This variable defines the paths or domain names that will be routed to the servers. By default, we route all paths and domain names to the servers. To override this, you should pass in a list of maps, where each map has the keys field and values. See the Condition Blocks documentation for the syntax to use: https://www.terraform.io/docs/providers/aws/r/lb_listener_rule.html.

list(object({
field = string
values = list(string)
}))
[
{
field = "path-pattern",
values = [
"*"
]
}
]

The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the load balancer-generated cookie is considered stale. The range is 1 second to 1 week (604800 seconds). Only used if enable_stickiness is true.

86400