aws.elbv2-target-group resource¶
Description¶
TargetGroup manages an ELBv2 target group as one resource, the way CloudFormation models AWS::ElasticLoadBalancingV2::TargetGroup. The name, port, protocol, protocol version, VPC, target type, IP address type, and target control port are fixed at creation, so a change to any of them replaces the group; the health check, stickiness, the scalar attributes, and tags reconcile in place. The health-check fields are flat, the form CreateTargetGroup takes them in, with the success-code matcher as its own block; a health-check field left unset keeps ELBv2's per-protocol default, and a change on update goes through ModifyTargetGroup. The remaining attributes are reconciled by a follow-on ModifyTargetGroupAttributes. A nil stickiness block leaves stickiness disabled.
Source: internal/service/elbv2/target_group_rsrc.go:44
Example usage:
imports: {
aws: 'github.com/cloudboss/unobin-library-aws'
}
resources: {
example: aws.elbv2-target-group {
# Set input fields here.
}
}
Inputs¶
name
string
target-type
optional(string)
port
optional(integer)
protocol
optional(string)
protocol-version
optional(string)
vpc-id
optional(string)
ip-address-type
optional(string)
target-control-port
optional(integer)
health-check-enabled
optional(boolean)
health-check-protocol
optional(string)
health-check-port
optional(string)
health-check-path
optional(string)
health-check-interval-seconds
optional(integer)
health-check-timeout-seconds
optional(integer)
healthy-threshold-count
optional(integer)
unhealthy-threshold-count
optional(integer)
matcher
optional(object)
optional(
object({
http-code: optional(string)
grpc-code: optional(string)
})
)
stickiness
optional(object)
optional(
object({
enabled: optional(boolean)
type: optional(string)
cookie-duration: optional(integer)
cookie-name: optional(string)
})
)
deregistration-delay
optional(integer)
slow-start
optional(integer)
load-balancing-algorithm-type
optional(string)
load-balancing-cross-zone-enabled
optional(string)
preserve-client-ip
optional(boolean)
proxy-protocol-v2
optional(boolean)
connection-termination
optional(boolean)
lambda-multi-value-headers-enabled
optional(boolean)
tags
map(string)
Input Constraints¶
Target type rules
a lambda target group takes no port, protocol, protocol-version, or vpc-id.
Rule logic
- When
input.target-type == 'lambda'- Require
input.port == null
&& input.protocol == null
&& input.protocol-version == null
&& input.vpc-id == null
a non-lambda target group requires port, protocol, and vpc-id.
Rule logic
- When
input.target-type != 'lambda'- Require
input.port != null
&& input.protocol != null
&& input.vpc-id != null
target-type must be instance, ip, lambda, or alb.
Rule logic
- When
input.target-type != null- Require
input.target-type == 'instance'
|| input.target-type == 'ip'
|| input.target-type == 'lambda'
|| input.target-type == 'alb'
Protocol version rules
protocol-version applies only when protocol is HTTP or HTTPS.
Rule logic
- When
input.protocol-version != null- Require
input.protocol == 'HTTP'
|| input.protocol == 'HTTPS'
Ip address type rules
ip-address-type must be ipv4 or ipv6.
Rule logic
- When
input.ip-address-type != null- Require
input.ip-address-type == 'ipv4'
|| input.ip-address-type == 'ipv6'
Load balancing algorithm type rules
algorithm type must be round_robin, least_outstanding_requests, or weighted_random.
Rule logic
- When
input.load-balancing-algorithm-type != null- Require
input.load-balancing-algorithm-type == 'round_robin'
|| input.load-balancing-algorithm-type == 'least_outstanding_requests'
|| input.load-balancing-algorithm-type == 'weighted_random'
Load balancing cross zone enabled rules
cross-zone-enabled must be true, false, or use_load_balancer_configuration.
Rule logic
- When
input.load-balancing-cross-zone-enabled != null- Require
input.load-balancing-cross-zone-enabled == 'true'
|| input.load-balancing-cross-zone-enabled == 'false'
|| input.load-balancing-cross-zone-enabled == 'use_load_balancer_configuration'
Port rules
port must be between 1 and 65535.
Rule logic
- When
input.port != null- Require
(input.port == null || input.port >= 1)
&& (input.port == null || input.port <= 65535)
Target control port rules
target-control-port must be between 1 and 65535.
Rule logic
- When
input.target-control-port != null- Require
(input.target-control-port == null || input.target-control-port >= 1)
&& (input.target-control-port == null || input.target-control-port <= 65535)
Deregistration delay rules
deregistration-delay must be between 0 and 3600.
Rule logic
- When
input.deregistration-delay != null- Require
(input.deregistration-delay == null || input.deregistration-delay >= 0)
&& (input.deregistration-delay == null || input.deregistration-delay <= 3600)
Slow start rules
slow-start must be 0 or between 30 and 900.
Rule logic
- When
input.slow-start != null- Require
(input.slow-start == null || input.slow-start >= 0)
&& (input.slow-start == null || input.slow-start <= 900)
Health check protocol rules
health-check-protocol must be HTTP, HTTPS, or TCP.
Rule logic
- When
input.health-check-protocol != null- Require
input.health-check-protocol == 'HTTP'
|| input.health-check-protocol == 'HTTPS'
|| input.health-check-protocol == 'TCP'
a TCP health check takes no path or matcher.
Rule logic
- When
input.health-check-protocol == 'TCP'- Require
input.health-check-path == null
&& input.matcher == null
a TCP health check is not valid for an HTTP/HTTPS or lambda group.
Rule logic
- When
input.health-check-protocol == 'TCP'- Require
!(input.protocol == 'HTTP' || input.protocol == 'HTTPS')
&& input.target-type != 'lambda'
Health check interval seconds rules
health-check-interval-seconds must be between 5 and 300.
Rule logic
- When
input.health-check-interval-seconds != null- Require
(input.health-check-interval-seconds == null || input.health-check-interval-seconds >= 5)
&& (input.health-check-interval-seconds == null || input.health-check-interval-seconds <= 300)
Health check timeout seconds rules
health-check-timeout-seconds must be between 2 and 120.
Rule logic
- When
input.health-check-timeout-seconds != null- Require
(input.health-check-timeout-seconds == null || input.health-check-timeout-seconds >= 2)
&& (input.health-check-timeout-seconds == null || input.health-check-timeout-seconds <= 120)
Healthy threshold count rules
healthy-threshold-count must be between 2 and 10.
Rule logic
- When
input.healthy-threshold-count != null- Require
(input.healthy-threshold-count == null || input.healthy-threshold-count >= 2)
&& (input.healthy-threshold-count == null || input.healthy-threshold-count <= 10)
Unhealthy threshold count rules
unhealthy-threshold-count must be between 2 and 10.
Rule logic
- When
input.unhealthy-threshold-count != null- Require
(input.unhealthy-threshold-count == null || input.unhealthy-threshold-count >= 2)
&& (input.unhealthy-threshold-count == null || input.unhealthy-threshold-count <= 10)
Matcher rules
At most one of matcher.http-code or matcher.grpc-code.
matcher requires http-code or grpc-code.
Rule logic
- When
input.matcher != null- Require
input.matcher.http-code != null
|| input.matcher.grpc-code != null
grpc-code applies only when protocol-version is GRPC.
Rule logic
- When
input.matcher.grpc-code != null- Require
input.protocol-version == 'GRPC'
Stickiness rules
stickiness requires a type.
Rule logic
- When
input.stickiness != null- Require
input.stickiness.type != null
stickiness type must be one of the ELBv2 stickiness types.
Rule logic
- When
input.stickiness.type != null- Require
input.stickiness.type == 'lb_cookie'
|| input.stickiness.type == 'app_cookie'
|| input.stickiness.type == 'source_ip'
|| input.stickiness.type == 'source_ip_dest_ip'
|| input.stickiness.type == 'source_ip_dest_ip_proto'
stickiness cookie-duration must be between 0 and 604800.
Rule logic
- When
input.stickiness.cookie-duration != null- Require
(input.stickiness.cookie-duration == null || input.stickiness.cookie-duration >= 0)
&& (input.stickiness.cookie-duration == null || input.stickiness.cookie-duration <= 604800)
cookie-name applies only to app_cookie stickiness.
Rule logic
- When
input.stickiness.cookie-name != null- Require
input.stickiness.type == 'app_cookie'
Outputs¶
arn
string
arn-suffix
string
load-balancer-arns
list(string)