UNPKG

@pulumi/awsx

Version:

[![Actions Status](https://github.com/pulumi/pulumi-awsx/workflows/master/badge.svg)](https://github.com/pulumi/pulumi-awsx/actions) [![Slack](http://www.pulumi.com/images/docs/badges/slack.svg)](https://slack.pulumi.com) [![NPM version](https://badge.fur

262 lines (260 loc) • 12.2 kB
import * as aws from "@pulumi/aws"; import * as pulumi from "@pulumi/pulumi"; import * as apigateway from "../apigateway"; import * as ec2 from "../ec2"; import { Listener, ListenerDefaultAction, ListenerDefaultActionArgs } from "./listener"; import { LoadBalancer, LoadBalancerSubnets } from "./loadBalancer"; import { TargetGroup, TargetGroupHealthCheck } from "./targetGroup"; export type NetworkProtocol = "HTTP" | "HTTPS" | "TCP" | "TLS" | "GENEVE" | "UDP" | "TCP_UDP"; export declare class NetworkLoadBalancer extends LoadBalancer { readonly listeners: NetworkListener[]; readonly targetGroups: NetworkTargetGroup[]; constructor(name: string, args?: NetworkLoadBalancerArgs, opts?: pulumi.ComponentResourceOptions); createListener(name: string, args: NetworkListenerArgs, opts?: pulumi.ComponentResourceOptions): NetworkListener; createTargetGroup(name: string, args: NetworkTargetGroupArgs, opts?: pulumi.ComponentResourceOptions): NetworkTargetGroup; } /** * Each target group is used to route requests to one or more registered targets. When you create * each listener rule, you specify a target group and conditions. When a rule condition is met, * traffic is forwarded to the corresponding target group. You can create different target groups * for different types of requests. For example, create one target group for general requests and * other target groups for requests to the microservices for your application. * You define health check settings for your load balancer on a per target group basis. Each target * group uses the default health check settings, unless you override them when you create the target * group or modify them later on. After you specify a target group in a rule for a listener, the * load balancer continually monitors the health of all targets registered with the target group * that are in an Availability Zone enabled for the load balancer. The load balancer routes requests * to the registered targets that are healthy. * * See https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-target-groups.html * for more details. */ export declare class NetworkTargetGroup extends TargetGroup { readonly loadBalancer: NetworkLoadBalancer; readonly listeners: NetworkListener[]; constructor(name: string, args: NetworkTargetGroupArgs, opts?: pulumi.ComponentResourceOptions); createListener(name: string, args: NetworkListenerArgs, opts?: pulumi.ComponentResourceOptions): NetworkListener; } /** * A listener is a process that checks for connection requests, using the protocol and port that you * configure. The rules that you define for a listener determine how the load balancer routes * requests to the targets in one or more target groups. * * See https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-listeners.html * for more details. */ export declare class NetworkListener extends Listener implements apigateway.IntegrationRouteTargetProvider { readonly loadBalancer: NetworkLoadBalancer; readonly defaultTargetGroup?: NetworkTargetGroup; private readonly __isNetworkListenerInstance; constructor(name: string, args: NetworkListenerArgs, opts?: pulumi.ComponentResourceOptions); target(name: string, parent: pulumi.Resource): pulumi.Input<apigateway.IntegrationTarget>; } export interface NetworkLoadBalancerArgs { /** * An existing aws.lb.LoadBalancer to use for this awsx.lb.LoadBalancer. * If this value is set then all other arguments are ignored. * If not provided, one will be created. */ loadBalancer?: aws.lb.LoadBalancer; /** * The vpc this load balancer will be used with. Defaults to `[Vpc.getDefault]` if * unspecified. */ vpc?: ec2.Vpc; /** * The name of the LoadBalancer. This name must be unique within your AWS account, can have a * maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not * begin or end with a hyphen. If not specified, the [name] parameter passed into the * LoadBalancer constructor will be hashed and used as the name. */ name?: string; /** * Whether or not the load balancer is exposed to the internet. Defaults to `true` if * unspecified. */ external?: boolean; /** * If true, deletion of the load balancer will be disabled via the AWS API. This will prevent * Terraform from deleting the load balancer. Defaults to `false`. */ enableDeletionProtection?: pulumi.Input<boolean>; /** * The type of IP addresses used by the subnets for your load balancer. The possible values are * `ipv4` and `dualstack` */ ipAddressType?: pulumi.Input<"ipv4" | "dualstack">; /** * A subnet mapping block as documented below. */ subnetMappings?: aws.lb.LoadBalancerArgs["subnetMappings"]; /** * A list of subnet IDs to attach to the LB. Subnets cannot be updated for Load Balancers of * type `network`. Changing this value for load balancers of type `network` will force a * recreation of the resource. */ subnets?: pulumi.Input<pulumi.Input<string>[]> | LoadBalancerSubnets; /** * A mapping of tags to assign to the resource. */ tags?: pulumi.Input<aws.Tags>; /** * If true, cross-zone load balancing of the load balancer will be enabled. Defaults to `false`. */ enableCrossZoneLoadBalancing?: pulumi.Input<boolean>; } /** * 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 NetworkTargetGroupHealthCheck extends TargetGroupHealthCheck { /** * 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?: never; } export interface NetworkTargetGroupArgs { /** * 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 this load balancer will be used with. Defaults to `[Vpc.getDefault]` if * unspecified. */ vpc?: ec2.Vpc; /** * The name of the TargetGroup. If not specified, the [name] parameter passed into the * TargetGroup constructor will be hashed and used as the name. If a [loadBalancer] is not * provided, this name will be used to name that resource as well. */ name?: string; /** * The load balancer this target group is associated with. If not provided, a new load balancer * will be automatically created. */ loadBalancer?: NetworkLoadBalancer; /** * 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>; /** * The protocol for connections from clients to the load balancer. Valid values are TCP, TLS, * HTTP and HTTPS. Defaults to TCP. */ protocol?: pulumi.Input<NetworkProtocol>; /** * 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>; /** * A Health Check block. Health Check blocks are documented below. */ healthCheck?: pulumi.Input<NetworkTargetGroupHealthCheck>; /** * 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). 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<"instance" | "ip">; } export interface NetworkListenerArgs { /** * An existing aws.lb.Listener to use for this awsx.lb.Listener. * If not provided, one will be created. */ listener?: aws.lb.Listener; /** * The vpc this load balancer will be used with. Defaults to `[Vpc.getDefault]` if * unspecified. */ vpc?: ec2.Vpc; /** * An explicit name to use for dependent resources. Specifically, if a LoadBalancer or * TargetGroup is not provided, this name will be used to name those resources. */ name?: string; /** * The load balancer this listener is associated with. If not provided, a new load balancer * will be automatically created. */ loadBalancer?: NetworkLoadBalancer | NetworkLoadBalancerArgs; /** * The port. Specify a value from `1` to `65535`. */ port: pulumi.Input<number>; /** * The protocol for connections from clients to the load balancer. Valid values are TCP, TLS, * HTTP and HTTPS. Defaults to TCP. */ protocol?: pulumi.Input<NetworkProtocol>; /** * An Action block. If neither this nor [defaultActions] is provided, a suitable defaultAction * will be chosen that forwards to a new [NetworkTargetGroup] created from [port]. * * Only provide one of [defaultAction], [defaultActions] or [targetGroup] */ defaultAction?: pulumi.Input<ListenerDefaultActionArgs> | ListenerDefaultAction; /** * An list of Action blocks. If neither this nor [defaultAction] is provided, a suitable * defaultAction will be chosen that forwards to a new [NetworkTargetGroup] created from * [port]. * * Only provide one of [defaultAction], [defaultActions] or [targetGroup] */ defaultActions?: pulumi.Input<pulumi.Input<ListenerDefaultActionArgs>[]>; /** * Target group this listener is associated with. This is used to determine the [defaultAction] * for the listener. * * Only provide one of [defaultAction], [defaultActions] or [targetGroup] */ targetGroup?: NetworkTargetGroup | NetworkTargetGroupArgs; /** * The ARN of the default SSL server certificate. Exactly one certificate is required if the * protocol is HTTPS. For adding additional SSL certificates, see the * [`aws_lb_listener_certificate` * resource](https://www.terraform.io/docs/providers/aws/r/lb_listener_certificate.html). */ certificateArn?: pulumi.Input<string>; /** * The name of the SSL Policy for the listener. Required if `protocol` is `HTTPS`. */ sslPolicy?: pulumi.Input<string>; }