UNPKG

@pulumi/aws

Version:

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

219 lines • 8.89 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:alb/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, { ...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?.arn; resourceInputs["arnSuffix"] = state?.arnSuffix; resourceInputs["connectionTermination"] = state?.connectionTermination; resourceInputs["deregistrationDelay"] = state?.deregistrationDelay; resourceInputs["healthCheck"] = state?.healthCheck; resourceInputs["ipAddressType"] = state?.ipAddressType; resourceInputs["lambdaMultiValueHeadersEnabled"] = state?.lambdaMultiValueHeadersEnabled; resourceInputs["loadBalancerArns"] = state?.loadBalancerArns; resourceInputs["loadBalancingAlgorithmType"] = state?.loadBalancingAlgorithmType; resourceInputs["loadBalancingAnomalyMitigation"] = state?.loadBalancingAnomalyMitigation; resourceInputs["loadBalancingCrossZoneEnabled"] = state?.loadBalancingCrossZoneEnabled; resourceInputs["name"] = state?.name; resourceInputs["namePrefix"] = state?.namePrefix; resourceInputs["port"] = state?.port; resourceInputs["preserveClientIp"] = state?.preserveClientIp; resourceInputs["protocol"] = state?.protocol; resourceInputs["protocolVersion"] = state?.protocolVersion; resourceInputs["proxyProtocolV2"] = state?.proxyProtocolV2; resourceInputs["region"] = state?.region; resourceInputs["slowStart"] = state?.slowStart; resourceInputs["stickiness"] = state?.stickiness; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["targetFailovers"] = state?.targetFailovers; resourceInputs["targetGroupHealth"] = state?.targetGroupHealth; resourceInputs["targetHealthStates"] = state?.targetHealthStates; resourceInputs["targetType"] = state?.targetType; resourceInputs["vpcId"] = state?.vpcId; } else { const args = argsOrState; resourceInputs["connectionTermination"] = args?.connectionTermination; resourceInputs["deregistrationDelay"] = args?.deregistrationDelay; resourceInputs["healthCheck"] = args?.healthCheck; resourceInputs["ipAddressType"] = args?.ipAddressType; resourceInputs["lambdaMultiValueHeadersEnabled"] = args?.lambdaMultiValueHeadersEnabled; resourceInputs["loadBalancingAlgorithmType"] = args?.loadBalancingAlgorithmType; resourceInputs["loadBalancingAnomalyMitigation"] = args?.loadBalancingAnomalyMitigation; resourceInputs["loadBalancingCrossZoneEnabled"] = args?.loadBalancingCrossZoneEnabled; resourceInputs["name"] = args?.name; resourceInputs["namePrefix"] = args?.namePrefix; resourceInputs["port"] = args?.port; resourceInputs["preserveClientIp"] = args?.preserveClientIp; resourceInputs["protocol"] = args?.protocol; resourceInputs["protocolVersion"] = args?.protocolVersion; resourceInputs["proxyProtocolV2"] = args?.proxyProtocolV2; resourceInputs["region"] = args?.region; resourceInputs["slowStart"] = args?.slowStart; resourceInputs["stickiness"] = args?.stickiness; resourceInputs["tags"] = args?.tags; resourceInputs["targetFailovers"] = args?.targetFailovers; resourceInputs["targetGroupHealth"] = args?.targetGroupHealth; resourceInputs["targetHealthStates"] = args?.targetHealthStates; resourceInputs["targetType"] = args?.targetType; resourceInputs["vpcId"] = args?.vpcId; 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:applicationloadbalancing/targetGroup:TargetGroup" }] }; opts = pulumi.mergeOptions(opts, aliasOpts); super(TargetGroup.__pulumiType, name, resourceInputs, opts); } } exports.TargetGroup = TargetGroup; /** @internal */ TargetGroup.__pulumiType = 'aws:alb/targetGroup:TargetGroup'; //# sourceMappingURL=targetGroup.js.map