UNPKG

@pulumi/aws

Version:

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

117 lines 4.76 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.TargetGroupAttachment = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides the ability to register instances and containers with an Application Load Balancer (ALB) or Network Load Balancer (NLB) target group. For attaching resources with Elastic Load Balancer (ELB), see the `aws.elb.Attachment` resource. * * > **Note:** `aws.alb.TargetGroupAttachment` is known as `aws.lb.TargetGroupAttachment`. The functionality is identical. * * ## Example Usage * * ### Basic Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const testTargetGroup = new aws.lb.TargetGroup("test", {}); * const testInstance = new aws.ec2.Instance("test", {}); * const test = new aws.lb.TargetGroupAttachment("test", { * targetGroupArn: testTargetGroup.arn, * targetId: testInstance.id, * port: 80, * }); * ``` * * ### Lambda Target * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const test = new aws.lb.TargetGroup("test", { * name: "test", * targetType: "lambda", * }); * const testFunction = new aws.lambda.Function("test", {}); * const withLb = new aws.lambda.Permission("with_lb", { * statementId: "AllowExecutionFromlb", * action: "lambda:InvokeFunction", * "function": testFunction.name, * principal: "elasticloadbalancing.amazonaws.com", * sourceArn: test.arn, * }); * const testTargetGroupAttachment = new aws.lb.TargetGroupAttachment("test", { * targetGroupArn: test.arn, * targetId: testFunction.arn, * }, { * dependsOn: [withLb], * }); * ``` * * ## Import * * You cannot import Target Group Attachments. */ class TargetGroupAttachment extends pulumi.CustomResource { /** * Get an existing TargetGroupAttachment 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 TargetGroupAttachment(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of TargetGroupAttachment. 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'] === TargetGroupAttachment.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["availabilityZone"] = state?.availabilityZone; resourceInputs["port"] = state?.port; resourceInputs["region"] = state?.region; resourceInputs["targetGroupArn"] = state?.targetGroupArn; resourceInputs["targetId"] = state?.targetId; } else { const args = argsOrState; if (args?.targetGroupArn === undefined && !opts.urn) { throw new Error("Missing required property 'targetGroupArn'"); } if (args?.targetId === undefined && !opts.urn) { throw new Error("Missing required property 'targetId'"); } resourceInputs["availabilityZone"] = args?.availabilityZone; resourceInputs["port"] = args?.port; resourceInputs["region"] = args?.region; resourceInputs["targetGroupArn"] = args?.targetGroupArn; resourceInputs["targetId"] = args?.targetId; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); const aliasOpts = { aliases: [{ type: "aws:applicationloadbalancing/targetGroupAttachment:TargetGroupAttachment" }] }; opts = pulumi.mergeOptions(opts, aliasOpts); super(TargetGroupAttachment.__pulumiType, name, resourceInputs, opts); } } exports.TargetGroupAttachment = TargetGroupAttachment; /** @internal */ TargetGroupAttachment.__pulumiType = 'aws:alb/targetGroupAttachment:TargetGroupAttachment'; //# sourceMappingURL=targetGroupAttachment.js.map