UNPKG

@pulumi/aws

Version:

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

228 lines (227 loc) • 10.1 kB
import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * 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 */ export declare 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: string, id: pulumi.Input<pulumi.ID>, state?: CapacityProviderState, opts?: pulumi.CustomResourceOptions): CapacityProvider; /** * 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: any): obj is CapacityProvider; /** * ARN that identifies the capacity provider. */ readonly arn: pulumi.Output<string>; /** * Configuration block for the provider for the ECS auto scaling group. Detailed below. Exactly one of `autoScalingGroupProvider` or `managedInstancesProvider` must be specified. */ readonly autoScalingGroupProvider: pulumi.Output<outputs.ecs.CapacityProviderAutoScalingGroupProvider | undefined>; /** * Name of the ECS cluster. Required when using `managedInstancesProvider`. Must not be set when using `autoScalingGroupProvider`. */ readonly cluster: pulumi.Output<string | undefined>; /** * Configuration block for the managed instances provider. Detailed below. Exactly one of `autoScalingGroupProvider` or `managedInstancesProvider` must be specified. */ readonly managedInstancesProvider: pulumi.Output<outputs.ecs.CapacityProviderManagedInstancesProvider | undefined>; /** * Name of the capacity provider. */ readonly name: pulumi.Output<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ readonly region: pulumi.Output<string>; /** * Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ readonly tags: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. */ readonly tagsAll: pulumi.Output<{ [key: string]: string; }>; /** * Create a CapacityProvider resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args?: CapacityProviderArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering CapacityProvider resources. */ export interface CapacityProviderState { /** * ARN that identifies the capacity provider. */ arn?: pulumi.Input<string>; /** * Configuration block for the provider for the ECS auto scaling group. Detailed below. Exactly one of `autoScalingGroupProvider` or `managedInstancesProvider` must be specified. */ autoScalingGroupProvider?: pulumi.Input<inputs.ecs.CapacityProviderAutoScalingGroupProvider>; /** * Name of the ECS cluster. Required when using `managedInstancesProvider`. Must not be set when using `autoScalingGroupProvider`. */ cluster?: pulumi.Input<string>; /** * Configuration block for the managed instances provider. Detailed below. Exactly one of `autoScalingGroupProvider` or `managedInstancesProvider` must be specified. */ managedInstancesProvider?: pulumi.Input<inputs.ecs.CapacityProviderManagedInstancesProvider>; /** * Name of the capacity provider. */ name?: pulumi.Input<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; /** * Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block. */ tagsAll?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; } /** * The set of arguments for constructing a CapacityProvider resource. */ export interface CapacityProviderArgs { /** * Configuration block for the provider for the ECS auto scaling group. Detailed below. Exactly one of `autoScalingGroupProvider` or `managedInstancesProvider` must be specified. */ autoScalingGroupProvider?: pulumi.Input<inputs.ecs.CapacityProviderAutoScalingGroupProvider>; /** * Name of the ECS cluster. Required when using `managedInstancesProvider`. Must not be set when using `autoScalingGroupProvider`. */ cluster?: pulumi.Input<string>; /** * Configuration block for the managed instances provider. Detailed below. Exactly one of `autoScalingGroupProvider` or `managedInstancesProvider` must be specified. */ managedInstancesProvider?: pulumi.Input<inputs.ecs.CapacityProviderManagedInstancesProvider>; /** * Name of the capacity provider. */ name?: pulumi.Input<string>; /** * Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration. */ region?: pulumi.Input<string>; /** * Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; }