UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

219 lines • 9.88 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.TargetGroup = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a Target Group resource for use with Load Balancer resources. * * > **Note:** `aws.alb.TargetGroup` is known as `aws.lb.TargetGroup`. The functionality is identical. * * ## Example Usage * * ### Instance Target Group * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const main = new aws.ec2.Vpc("main", {cidrBlock: "10.0.0.0/16"}); * const test = new aws.lb.TargetGroup("test", { * name: "tf-example-lb-tg", * port: 80, * protocol: "HTTP", * vpcId: main.id, * }); * ``` * * ### IP Target Group * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const main = new aws.ec2.Vpc("main", {cidrBlock: "10.0.0.0/16"}); * const ip_example = new aws.lb.TargetGroup("ip-example", { * name: "tf-example-lb-tg", * port: 80, * protocol: "HTTP", * targetType: "ip", * vpcId: main.id, * }); * ``` * * ### Lambda Target Group * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const lambda_example = new aws.lb.TargetGroup("lambda-example", { * name: "tf-example-lb-tg", * targetType: "lambda", * }); * ``` * * ### ALB Target Group * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const alb_example = new aws.lb.TargetGroup("alb-example", { * name: "tf-example-lb-alb-tg", * targetType: "alb", * port: 80, * protocol: "TCP", * vpcId: main.id, * }); * ``` * * ### Target group with unhealthy connection termination disabled * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const tcp_example = new aws.lb.TargetGroup("tcp-example", { * name: "tf-example-lb-nlb-tg", * port: 25, * protocol: "TCP", * vpcId: main.id, * targetHealthStates: [{ * enableUnhealthyConnectionTermination: false, * }], * }); * ``` * * ### Target group with health requirements * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const tcp_example = new aws.lb.TargetGroup("tcp-example", { * name: "tf-example-lb-nlb-tg", * port: 80, * protocol: "TCP", * vpcId: main.id, * targetGroupHealth: { * dnsFailover: { * minimumHealthyTargetsCount: "1", * minimumHealthyTargetsPercentage: "off", * }, * unhealthyStateRouting: { * minimumHealthyTargetsCount: 1, * minimumHealthyTargetsPercentage: "off", * }, * }, * }); * ``` * * ## Import * * Using `pulumi import`, import Target Groups using their ARN. For example: * * ```sh * $ pulumi import aws:lb/targetGroup:TargetGroup app_front_end arn:aws:elasticloadbalancing:us-west-2:187416307283:targetgroup/app-front-end/20cfe21448b66314 * ``` */ class TargetGroup extends pulumi.CustomResource { /** * Get an existing TargetGroup resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new TargetGroup(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of TargetGroup. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === TargetGroup.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state ? state.arn : undefined; resourceInputs["arnSuffix"] = state ? state.arnSuffix : undefined; resourceInputs["connectionTermination"] = state ? state.connectionTermination : undefined; resourceInputs["deregistrationDelay"] = state ? state.deregistrationDelay : undefined; resourceInputs["healthCheck"] = state ? state.healthCheck : undefined; resourceInputs["ipAddressType"] = state ? state.ipAddressType : undefined; resourceInputs["lambdaMultiValueHeadersEnabled"] = state ? state.lambdaMultiValueHeadersEnabled : undefined; resourceInputs["loadBalancerArns"] = state ? state.loadBalancerArns : undefined; resourceInputs["loadBalancingAlgorithmType"] = state ? state.loadBalancingAlgorithmType : undefined; resourceInputs["loadBalancingAnomalyMitigation"] = state ? state.loadBalancingAnomalyMitigation : undefined; resourceInputs["loadBalancingCrossZoneEnabled"] = state ? state.loadBalancingCrossZoneEnabled : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["namePrefix"] = state ? state.namePrefix : undefined; resourceInputs["port"] = state ? state.port : undefined; resourceInputs["preserveClientIp"] = state ? state.preserveClientIp : undefined; resourceInputs["protocol"] = state ? state.protocol : undefined; resourceInputs["protocolVersion"] = state ? state.protocolVersion : undefined; resourceInputs["proxyProtocolV2"] = state ? state.proxyProtocolV2 : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["slowStart"] = state ? state.slowStart : undefined; resourceInputs["stickiness"] = state ? state.stickiness : undefined; resourceInputs["tags"] = state ? state.tags : undefined; resourceInputs["tagsAll"] = state ? state.tagsAll : undefined; resourceInputs["targetFailovers"] = state ? state.targetFailovers : undefined; resourceInputs["targetGroupHealth"] = state ? state.targetGroupHealth : undefined; resourceInputs["targetHealthStates"] = state ? state.targetHealthStates : undefined; resourceInputs["targetType"] = state ? state.targetType : undefined; resourceInputs["vpcId"] = state ? state.vpcId : undefined; } else { const args = argsOrState; resourceInputs["connectionTermination"] = args ? args.connectionTermination : undefined; resourceInputs["deregistrationDelay"] = args ? args.deregistrationDelay : undefined; resourceInputs["healthCheck"] = args ? args.healthCheck : undefined; resourceInputs["ipAddressType"] = args ? args.ipAddressType : undefined; resourceInputs["lambdaMultiValueHeadersEnabled"] = args ? args.lambdaMultiValueHeadersEnabled : undefined; resourceInputs["loadBalancingAlgorithmType"] = args ? args.loadBalancingAlgorithmType : undefined; resourceInputs["loadBalancingAnomalyMitigation"] = args ? args.loadBalancingAnomalyMitigation : undefined; resourceInputs["loadBalancingCrossZoneEnabled"] = args ? args.loadBalancingCrossZoneEnabled : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["namePrefix"] = args ? args.namePrefix : undefined; resourceInputs["port"] = args ? args.port : undefined; resourceInputs["preserveClientIp"] = args ? args.preserveClientIp : undefined; resourceInputs["protocol"] = args ? args.protocol : undefined; resourceInputs["protocolVersion"] = args ? args.protocolVersion : undefined; resourceInputs["proxyProtocolV2"] = args ? args.proxyProtocolV2 : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["slowStart"] = args ? args.slowStart : undefined; resourceInputs["stickiness"] = args ? args.stickiness : undefined; resourceInputs["tags"] = args ? args.tags : undefined; resourceInputs["targetFailovers"] = args ? args.targetFailovers : undefined; resourceInputs["targetGroupHealth"] = args ? args.targetGroupHealth : undefined; resourceInputs["targetHealthStates"] = args ? args.targetHealthStates : undefined; resourceInputs["targetType"] = args ? args.targetType : undefined; resourceInputs["vpcId"] = args ? args.vpcId : undefined; resourceInputs["arn"] = undefined /*out*/; resourceInputs["arnSuffix"] = undefined /*out*/; resourceInputs["loadBalancerArns"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const aliasOpts = { aliases: [{ type: "aws:elasticloadbalancingv2/targetGroup:TargetGroup" }] }; opts = pulumi.mergeOptions(opts, aliasOpts); super(TargetGroup.__pulumiType, name, resourceInputs, opts); } } exports.TargetGroup = TargetGroup; /** @internal */ TargetGroup.__pulumiType = 'aws:lb/targetGroup:TargetGroup'; //# sourceMappingURL=targetGroup.js.map