@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
154 lines • 6.47 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.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.
*
* > **NOTE:** You must specify exactly one of `autoScalingGroupProvider` or `managedInstancesProvider`. When using `managedInstancesProvider`, the `cluster` parameter is required. When using `autoScalingGroupProvider`, the `cluster` parameter must not be set.
*
* ## Example Usage
*
* ### Auto Scaling Group Provider
*
* ```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,
* },
* },
* });
* ```
*
* ### Managed Instances Provider
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.ecs.CapacityProvider("example", {
* name: "example",
* cluster: "my-cluster",
* managedInstancesProvider: {
* infrastructureRoleArn: ecsInfrastructure.arn,
* propagateTags: "TASK_DEFINITION",
* instanceLaunchTemplate: {
* ec2InstanceProfileArn: ecsInstance.arn,
* monitoring: "ENABLED",
* networkConfiguration: {
* subnets: [exampleAwsSubnet.id],
* securityGroups: [exampleAwsSecurityGroup.id],
* },
* storageConfiguration: {
* storageSizeGib: 30,
* },
* instanceRequirements: {
* memoryMib: {
* min: 1024,
* max: 8192,
* },
* vcpuCount: {
* min: 1,
* max: 4,
* },
* instanceGenerations: ["current"],
* cpuManufacturers: [
* "intel",
* "amd",
* ],
* },
* },
* },
* });
* ```
*
* ## Import
*
* ### Identity Schema
*
* #### Required
*
* - `arn` (String) Amazon Resource Name (ARN) of the ECS capacity provider.
*
* Using `pulumi import`, import ECS Capacity Providers using the `arn`. For example:
*
* console
*
* % pulumi import aws_ecs_capacity_provider.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["cluster"] = state?.cluster;
resourceInputs["managedInstancesProvider"] = state?.managedInstancesProvider;
resourceInputs["name"] = state?.name;
resourceInputs["region"] = state?.region;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
}
else {
const args = argsOrState;
resourceInputs["autoScalingGroupProvider"] = args?.autoScalingGroupProvider;
resourceInputs["cluster"] = args?.cluster;
resourceInputs["managedInstancesProvider"] = args?.managedInstancesProvider;
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