Skip to content

Latest commit

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..

README.md

alb-instance-target-group

This module creates following resources.

  • aws_lb_target_group
  • aws_lb_target_group_attachment (optional)

Requirements

Name Version
terraform >= 1.12
aws >= 6.42

Providers

Name Version
aws 6.42.0

Modules

Name Source Version
resource_group tedilabs/misc/aws//modules/resource-group ~> 0.12.0

Resources

Name Type
aws_lb_target_group.this resource
aws_lb_target_group_attachment.this resource

Inputs

Name Description Type Default Required
name (Required) Name of the target group. A maximum of 32 alphanumeric characters including hyphens are allowed, but the name must not begin or end with a hyphen. string n/a yes
port (Required) The number of port on which targets receive traffic, unless overridden when registering a specific target. Valid values are either ports 1-65535. number n/a yes
protocol (Required) The protocol to use for routing traffic to the targets. Valid values are HTTP and HTTPS. string n/a yes
vpc_id (Required) The ID of the VPC which the target group belongs to. string n/a yes
deregistration_delay (Optional) The time to wait for in-flight requests to complete while deregistering a target. During this time, the state of the target is draining. Valid values are from 0 to 3600 seconds. Defaults to 300 seconds. number 300 no
dns_failover_condition (Optional) A configuration for the DNS Failover requirements. The minimum healthy targets required to maintain the load balancer's zonal IP addresses in the DNS record, allowing for new client connections. If this requirement is not met, DNS failover is initiated. This means that the load balancer's zonal IP address is removed from the DNS record preventing the load balancer from sending new client connections to unhealthy zones. dns_failover_condition as defined below.
(Optional) min_healthy_targets - A minimum condition for the number or percentage of healthy targets in a target group. To count as healthy, a target must pass health checks and not be part of an active zonal shift. min_healthy_targets as defined below.
(Optional) count - The minimum number of targets that must be healthy. If the number of healthy targets is below this value, mark the zone as unhealthy in DNS, so that traffic is routed only to healthy zones. Valid values are from 0 (Disabled) to the total number of targets in the target group. Defaults to 1.
(Optional) percentage - The minimum percentage of targets that must be healthy. If the percentage of healthy targets is below this value, mark the zone as unhealthy in DNS, so that traffic is routed only to healthy zones. Valid values are from 0 to 100. Defaults to 0 (Disabled).
object({
min_healthy_targets = optional(object({
count = optional(number, 1)
percentage = optional(number, 0)
}), {})
})
{} no
health_check (Optional) A configurations for Health Check of the target group. The associated load balancer periodically sends requests to the registered targets to test their status. health_check block as defined below.
(Optional) protocol - Protocol to use to connect with the target. The possible values are HTTP and HTTPS. Defaults to HTTP.
(Optional) port - The port the load balancer uses when performing health checks on targets. The default is the port on which each target receives traffic from the load balancer. Valid values are either ports 1-65535.
(Optional) port_override - Whether to override the port on which each target receives traffic from the load balancer to a different port. Defaults to false.
(Optional) path - The ping path for the HTTP or HTTPS protocol. Defaults to / if the protocol version is HTTP1 or HTTP2, and /AWS.ALB/healthcheck if the protocol version is GRPC. A path can have a maximum of 1024 characters.
(Optional) success_codes - The HTTP codes to use when checking for a successful response from a target. You can specify multiple values (for example, 200,202) or a range of values (for example, 200-299).
(Optional) healthy_threshold - The number of consecutive health checks successes required before considering an unhealthy target healthy. Valid value range is 2 - 10. Defaults to 5.
(Optional) unhealthy_threshold - The number of consecutive health check failures required before considering a target unhealthy. Valid value range is 2 - 10. Defaults to 2.
(Optional) interval - Approximate amount of time, in seconds, between health checks of an individual target. Valid value range is 5 - 300. Defaults to 30.
(Optional) timeout - The amount of time, in seconds, during which no response means a failed health check. Valid value range is 2 - 120. Defaults to 5.
object({
protocol = optional(string, "HTTP")
port = optional(number)
port_override = optional(bool, false)
path = optional(string, "")
success_codes = optional(string)

healthy_threshold = optional(number, 5)
unhealthy_threshold = optional(number, 2)
interval = optional(number, 30)
timeout = optional(number, 5)
})
{} no
ip_address_type (Optional) The type of IP addresses used by the target group. Valid values are IPV4 or IPV6. Defaults to IPV4. string "IPV4" no
load_balancing (Optional) A load balancing configuration of the target group. load_balancing block as defined below.
(Optional) algorithm - Determines how the load balancer selects targets when routing requests. Valid values are ROUND_ROBIN, LEAST_OUTSTANDING_REQUESTS or WEIGHTED_RANDOM. Defaults to ROUND_ROBIN.
(Optional) anomaly_mitigation_enabled - Whether to enable target anomaly mitigation. When a target is determined to be anomalous, traffic is automatically routed away so the target has an opportunity to recover. Target anomaly mitigation is only supported by the WEIGHTED_RANDOM load balancing algorithm type. Not compatible with the slow_start_duration attribute. Defaults to false.
(Optional) cross_zone_strategy - Determines how the load balancer routes requests across the Availability Zones. Valid values are ENABLED, DISABLED or INHERIT. Defaults to INHERIT (Use load balancer configuration).
(Optional) slow_start_duration - The amount time for a newly registered targets to warm up before the load balancer sends them a full share of requests. During this period, targets receives an increasing share of requests until it reaches its fair share. Requires 30 to 900 seconds to enable, or 0 seconds to disable. Not compatible with the Least outstanding requests and Weighted random routing algorithms. Defaults to 0.
(Optional) stickiness - A stickiness configuration for the target group. stickiness block as defined below.
(Optional) enabled - Whether to enable the type of stickiness associated with this target group. If enabled, the load balancer binds a client鈥檚 session to a specific instance within the target group. Defaults to false.
(Optional) type - The type of sticky sessions. Valid values are LB_COOKIE or APP_COOKIE. Defaults to LB_COOKIE.
(Optional) duration - 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. Valid values are from 1 to 604800 (1 week). Defaults to 86400 (1 day).
(Optional) cookie - The name of the application based cookie. AWSALB, AWSALBAPP, and AWSALBTG prefixes are reserved and cannot be used. Only needed when type is APP_COOKIE.
object({
algorithm = optional(string, "ROUND_ROBIN")
anomaly_mitigation_enabled = optional(bool, false)
cross_zone_strategy = optional(string, "INHERIT")
slow_start_duration = optional(number, 0)
stickiness = optional(object({
enabled = optional(bool, false)
type = optional(string, "LB_COOKIE")
duration = optional(number, 86400)
cookie = optional(string, "")
}), {})
})
{} no
module_tags_enabled (Optional) Whether to create AWS Resource Tags for the module informations. bool true no
protocol_version (Optional) Use HTTP1 to send requests to targets using HTTP/1.1. Supported when the request protocol is HTTP/1.1 or HTTP/2. Use HTTP2 to send requests to targets using HTTP/2. Supported when the request protocol is HTTP/2 or gRPC, but gRPC-specific features are not available. Use GRPC to send requests to targets using gRPC. Supported when the request protocol is gRPC. Defaults to HTTP1. string "HTTP1" no
region (Optional) The region in which to create the module resources. If not provided, the module resources will be created in the provider's configured region. string null no
resource_group (Optional) A configurations of Resource Group for this module. resource_group as defined below.
(Optional) enabled - Whether to create Resource Group to find and group AWS resources which are created by this module. Defaults to true.
(Optional) name - The name of Resource Group. A Resource Group name can have a maximum of 127 characters, including letters, numbers, hyphens, dots, and underscores. The name cannot start with AWS or aws. If not provided, a name will be generated using the module name and instance name.
(Optional) description - The description of Resource Group. Defaults to Managed by Terraform..
object({
enabled = optional(bool, true)
name = optional(string, "")
description = optional(string, "Managed by Terraform.")
})
{} no
tags (Optional) A map of tags to add to all resources. map(string) {} no
target_optimizer (Optional) A configuration for the target optimizer feature of the target group. Use a target control port when the target has a strict concurrency limit. target_optimizer block as defined below.
(Optional) target_control_port - The port on which the target control agent and application load balancer exchange management traffic for the target optimizer feature. Only valid for ALB instance/ip target groups.
object({
target_control_port = optional(number)
})
{} no
targets (Optional) A set of targets to add to the target group. Each value of targets block as defined below.
(Required) instance - This is the Instance ID for an instance, or the container ID for an ECS container.
(Optional) port - The port on which targets receive traffic.
set(object({
instance = string
port = optional(number)
}))
[] no
unhealthy_state_routing_condition (Optional) A configuration for unhealthy state routing requirements. The minimum healthy targets required to deliver your service. If either the count or percentage value requirement is not met, then the unhealthy state routing action is taken. When this happens, the load balancer should fail open, sending traffic to all targets (including unhealthy targets). unhealthy_state_routing_condition as defined below.
(Optional) min_healthy_targets - A minimum condition for the number or percentage of healthy targets in a target group. To count as healthy, a target must pass health checks and not be part of an active zonal shift. min_healthy_targets as defined below.
(Optional) count - The minimum number of targets that must be healthy. If the number of healthy targets is below this value, send traffic to all targets, including unhealthy targets. Valid values are from 1 to the total number of targets in the target group. Defaults to 1.
(Optional) percentage - The minimum percentage of targets that must be healthy. If the percentage of healthy targets is below this value, send traffic to all targets, including unhealthy targets. Valid values are from 0 to 100. Defaults to 0 (Disabled).
object({
min_healthy_targets = optional(object({
count = optional(number, 1)
percentage = optional(number, 0)
}), {})
})
{} no

Outputs

Name Description
arn The Amazon Resource Name (ARN) of the target group.
arn_suffix The ARN suffix for use with CloudWatch Metrics.
attributes Attributes of the Instance target group of application load balancer.
dns_failover_condition The configuration for DNS failover requirements.
health_check Health Check configuration of the target group.
id The ID of the target group.
ip_address_type The type of IP addresses used by the target group.
load_balancers The ARNs (Amazon Resource Name) of the load balancers associated with the target group.
name The name of the target group.
port The port number on which the target receive trrafic.
protocol The protocol to use to connect with the target.
protocol_version The protocol version to use to send requests to targets.
region The AWS region this module resources resides in.
resource_group The resource group created to manage resources in this module.
target_optimizer The Target Optimizer configuration of the target group.
targets A set of targets in the target group.
type The target type of the target group.
unhealthy_state_routing_condition The configuration for unhealthy state routing requirements.
vpc_id The ID of the VPC which the target group belongs to.