@pulumi/awsx
Version:
[](https://github.com/pulumi/pulumi-awsx/actions) [](https://slack.pulumi.com) [ • 8.2 kB
TypeScript
import * as aws from "@pulumi/aws";
import * as pulumi from "@pulumi/pulumi";
import * as ec2 from "../ec2";
import * as ecs from "../ecs";
import { Listener, ListenerActions, ListenerDefaultAction, ListenerDefaultActionArgs } from "./listener";
import { LoadBalancer, LoadBalancerTarget } from "./loadBalancer";
import { TargetGroupAttachment } from "./targetGroupAttachment";
export declare abstract class TargetGroup extends pulumi.ComponentResource implements ecs.ContainerPortMappingProvider, ecs.ContainerLoadBalancerProvider, ListenerDefaultAction, ListenerActions {
readonly loadBalancer: LoadBalancer;
readonly targetGroup: aws.lb.TargetGroup;
readonly vpc: ec2.Vpc;
readonly listeners: Listener[];
constructor(type: string, name: string, loadBalancer: LoadBalancer, args: TargetGroupArgs, opts: pulumi.ComponentResourceOptions);
private dependencies;
containerPortMapping(): pulumi.Input<aws.ecs.PortMapping>;
containerLoadBalancer(): pulumi.Input<ecs.ContainerLoadBalancer>;
listenerDefaultAction(): pulumi.Input<ListenerDefaultActionArgs>;
actions(): aws.lb.ListenerRuleArgs["actions"];
/** Do not call directly. Intended for use by [Listener] and [ListenerRule] */
registerListener(listener: Listener): void;
/**
* Attaches a target to this target group. See
* [Register-Targets](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-register-targets.html)
* for more details.
*/
attachTarget(name: string, args: LoadBalancerTarget, opts?: pulumi.CustomResourceOptions): TargetGroupAttachment;
}
/**
* A Health Check block.
*
* The Health Check parameters you can set vary by the protocol of the Target Group. Many
* parameters cannot be set to custom values for network load balancers at this time. See
* http://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_CreateTargetGroup.html
* for a complete reference. Keep in mind, that health checks produce actual requests to the
* backend. The underlying function is invoked when target_type is set to lambda.
*/
export interface TargetGroupHealthCheck {
/**
* The approximate amount of time, in seconds, between health checks of an individual
* target. Minimum value 5 seconds, Maximum value 300 seconds. For lambda target groups, it
* needs to be greater as the [timeout] of the underlying [lambda]. Default 30 seconds.
*/
interval?: pulumi.Input<number>;
/**
* 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").
* Applies to Application Load Balancers only (HTTP/HTTPS), not Network Load Balancers (TCP)
*/
matcher?: pulumi.Input<string>;
/**
* (Required for HTTP/HTTPS ALB) The destination for the health check request. Applies to
* Application Load Balancers only (HTTP/HTTPS), not Network Load Balancers (TCP).
*/
path?: pulumi.Input<string>;
/**
* The port to use to connect with the target.
*/
port?: pulumi.Input<string>;
/**
* The protocol to use to connect with the target. Defaults to HTTP. Not applicable when
* target_type is [lambda].
*/
protocol?: pulumi.Input<string>;
/**
* The amount of time, in seconds, during which no response means a failed health check. For
* Application Load Balancers, the range is 2 to 60 seconds and the default is 5 seconds.
* For Network Load Balancers, you cannot set a custom value, and the default is 10 seconds
* for TCP and HTTPS health checks and 6 seconds for HTTP health checks.
*/
timeout?: pulumi.Input<number>;
/**
* The number of consecutive health checks successes required before considering an
* unhealthy target healthy. Defaults to 3.
*/
healthyThreshold?: pulumi.Input<number>;
/**
* The number of consecutive health check failures required before considering the target
* unhealthy. For Network Load Balancers, this value must be the same as the
* healthy_threshold. Defaults to 3.
*/
unhealthyThreshold?: pulumi.Input<number>;
}
export interface TargetGroupArgs {
/**
* An existing aws.lb.TargetGroup to use for this awsx.lb.TargetGroup.
* If not provided, one will be created.
*/
targetGroup?: aws.lb.TargetGroup;
/**
* The vpc for this target group.
*/
vpc: ec2.Vpc;
/**
* @deprecated Not used. Supply the name you want for a TargetGroup through the [name]
* constructor arg.
*/
name?: string;
/**
* The amount time for Elastic Load Balancing to wait before changing the state of a
* deregistering target from draining to unused. The range is 0-3600 seconds. The default value
* is 300 seconds.
*/
deregistrationDelay?: pulumi.Input<number>;
/**
* Health check parameters for this target group.
*/
healthCheck?: pulumi.Input<TargetGroupHealthCheck>;
/**
* The port to use to connect with the target. Valid values are either ports 1-65536, or
* `traffic-port`. Defaults to `traffic-port`.
*/
port: pulumi.Input<number> | undefined;
/**
* The protocol to use to connect with the target.
*/
protocol: pulumi.Input<"HTTP" | "HTTPS" | "TCP" | "TLS" | "GENEVE" | "UDP" | "TCP_UDP"> | undefined;
/**
* Boolean to enable / disable support for proxy protocol v2 on Network Load Balancers. See
* [doc](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-target-groups.html#proxy-protocol)
* for more information.
*/
proxyProtocolV2?: pulumi.Input<boolean>;
/**
* The amount time for targets to warm up before the load balancer sends them a full share of
* requests. The range is 30-900 seconds or 0 to disable. The default value is 0 seconds.
*/
slowStart?: pulumi.Input<number>;
/**
* A Stickiness block. Stickiness blocks are documented below. `stickiness` is only valid if
* used with Load Balancers of type `Application`
*/
stickiness?: aws.lb.TargetGroupArgs["stickiness"];
/**
* A mapping of tags to assign to the resource.
*/
tags?: pulumi.Input<aws.Tags>;
/**
* The type of target that you must specify when registering targets with this target group. The
* possible values are `instance` (targets are specified by instance ID) or `ip` (targets are
* specified by IP address) or `lambda` (targets are specified by lambda arn). The default is
* `ip`. Note that you can't specify targets for a target group using both instance IDs
* and IP addresses. If the target type is `ip`, specify IP addresses from the subnets of the
* virtual private cloud (VPC) for the target group, the RFC 1918 range (10.0.0.0/8,
* 172.16.0.0/12, and 192.168.0.0/16), and the RFC 6598 range (100.64.0.0/10). You can't specify
* publicly routable IP addresses.
*/
targetType?: pulumi.Input<TargetType>;
}
/**
* The type of target that you must specify when registering targets with a target group. The
* possible values are `instance` (targets are specified by instance ID) or `ip` (targets are
* specified by IP address) or `lambda` (targets are specified by lambda arn). The default is `ip`.
* Note that you can't specify targets for a target group using both instance IDs and IP addresses.
* If the target type is `ip`, specify IP addresses from the subnets of the virtual private cloud
* (VPC) for the target group, the RFC 1918 range (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16),
* and the RFC 6598 range (100.64.0.0/10). You can't specify publicly routable IP addresses.
*
* Network Load Balancers do not support the lambda target type, only Application Load Balancers
* support the lambda target type. For more information, see
* [Lambda-Functions-as-Targets](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html#register-lambda-function)
* in the User Guide for Application Load Balancers.
*/
export type TargetType = "instance" | "ip" | "lambda";