@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
87 lines • 3.98 kB
JavaScript
;
// *** 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.Attachment = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Attaches a load balancer to an Auto Scaling group.
*
* > **NOTE on Auto Scaling Groups, Attachments and Traffic Source Attachments:** Pulumi provides standalone Attachment (for attaching Classic Load Balancers and Application Load Balancer, Gateway Load Balancer, or Network Load Balancer target groups) and Traffic Source Attachment (for attaching Load Balancers and VPC Lattice target groups) resources and an Auto Scaling Group resource with `loadBalancers`, `targetGroupArns` and `trafficSource` attributes. Do not use the same traffic source in more than one of these resources. Doing so will cause a conflict of attachments. A `lifecycle` configuration block can be used to suppress differences if necessary.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* // Create a new load balancer attachment
* const example = new aws.autoscaling.Attachment("example", {
* autoscalingGroupName: exampleAwsAutoscalingGroup.id,
* elb: exampleAwsElb.id,
* });
* ```
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* // Create a new ALB Target Group attachment
* const example = new aws.autoscaling.Attachment("example", {
* autoscalingGroupName: exampleAwsAutoscalingGroup.id,
* lbTargetGroupArn: exampleAwsLbTargetGroup.arn,
* });
* ```
*/
class Attachment extends pulumi.CustomResource {
/**
* Get an existing Attachment 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 Attachment(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Attachment. 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'] === Attachment.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["autoscalingGroupName"] = state?.autoscalingGroupName;
resourceInputs["elb"] = state?.elb;
resourceInputs["lbTargetGroupArn"] = state?.lbTargetGroupArn;
resourceInputs["region"] = state?.region;
}
else {
const args = argsOrState;
if (args?.autoscalingGroupName === undefined && !opts.urn) {
throw new Error("Missing required property 'autoscalingGroupName'");
}
resourceInputs["autoscalingGroupName"] = args?.autoscalingGroupName;
resourceInputs["elb"] = args?.elb;
resourceInputs["lbTargetGroupArn"] = args?.lbTargetGroupArn;
resourceInputs["region"] = args?.region;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Attachment.__pulumiType, name, resourceInputs, opts);
}
}
exports.Attachment = Attachment;
/** @internal */
Attachment.__pulumiType = 'aws:autoscaling/attachment:Attachment';
//# sourceMappingURL=attachment.js.map