UNPKG

@pulumi/aws

Version:

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

101 lines 4.65 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.CapacityProvider = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides an ECS cluster capacity provider. More information can be found on the [ECS Developer Guide](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-capacity-providers.html). * * > **NOTE:** Associating an ECS Capacity Provider to an Auto Scaling Group will automatically add the `AmazonECSManaged` tag to the Auto Scaling Group. This tag should be included in the `aws.autoscaling.Group` resource configuration to prevent the provider from removing it in subsequent executions as well as ensuring the `AmazonECSManaged` tag is propagated to all EC2 Instances in the Auto Scaling Group if `minSize` is above 0 on creation. Any EC2 Instances in the Auto Scaling Group without this tag must be manually be updated, otherwise they may cause unexpected scaling behavior and metrics. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.autoscaling.Group("example", {tags: [{ * key: "AmazonECSManaged", * value: "true", * propagateAtLaunch: true, * }]}); * const exampleCapacityProvider = new aws.ecs.CapacityProvider("example", { * name: "example", * autoScalingGroupProvider: { * autoScalingGroupArn: example.arn, * managedTerminationProtection: "ENABLED", * managedScaling: { * maximumScalingStepSize: 1000, * minimumScalingStepSize: 1, * status: "ENABLED", * targetCapacity: 10, * }, * }, * }); * ``` * * ## Import * * Using `pulumi import`, import ECS Capacity Providers using the `arn`. For example: * * ```sh * $ pulumi import aws:ecs/capacityProvider:CapacityProvider example arn:aws:ecs:us-west-2:123456789012:capacity-provider/example * ``` */ class CapacityProvider extends pulumi.CustomResource { /** * Get an existing CapacityProvider 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 CapacityProvider(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of CapacityProvider. 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'] === CapacityProvider.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["autoScalingGroupProvider"] = state?.autoScalingGroupProvider; resourceInputs["name"] = state?.name; resourceInputs["region"] = state?.region; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; } else { const args = argsOrState; if (args?.autoScalingGroupProvider === undefined && !opts.urn) { throw new Error("Missing required property 'autoScalingGroupProvider'"); } resourceInputs["autoScalingGroupProvider"] = args?.autoScalingGroupProvider; resourceInputs["name"] = args?.name; resourceInputs["region"] = args?.region; resourceInputs["tags"] = args?.tags; resourceInputs["arn"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(CapacityProvider.__pulumiType, name, resourceInputs, opts); } } exports.CapacityProvider = CapacityProvider; /** @internal */ CapacityProvider.__pulumiType = 'aws:ecs/capacityProvider:CapacityProvider'; //# sourceMappingURL=capacityProvider.js.map