Resource: awsEcsClusterCapacityProviders
Manages the capacity providers of an ECS Cluster.
More information about capacity providers can be found in the ECS User Guide.
\~> NOTE on Clusters and Cluster Capacity Providers: Terraform provides both a standalone awsEcsClusterCapacityProviders
resource, as well as allowing the capacity providers and default strategies to be managed in-line by the awsEcsCluster
resource. You cannot use a Cluster with in-line capacity providers in conjunction with the Capacity Providers resource, nor use more than one Capacity Providers resource with a single Cluster, as doing so will cause a conflict and will lead to mutual overwrites.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsEcsClusterExample = new aws.ecsCluster.EcsCluster(this, "example", {
name: "my-cluster",
});
const awsEcsClusterCapacityProvidersExample =
new aws.ecsClusterCapacityProviders.EcsClusterCapacityProviders(
this,
"example_1",
{
capacityProviders: ["FARGATE"],
clusterName: awsEcsClusterExample.name,
defaultCapacityProviderStrategy: [
{
base: 1,
capacityProvider: "FARGATE",
weight: 100,
},
],
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsEcsClusterCapacityProvidersExample.overrideLogicalId("example");
Argument Reference
The following arguments are supported:
capacityProviders
- (Optional) Set of names of one or more capacity providers to associate with the cluster. Valid values also includefargate
andFARGATE_SPOT
.clusterName
- (Required, Forces new resource) Name of the ECS cluster to manage capacity providers for.defaultCapacityProviderStrategy
- (Optional) Set of capacity provider strategies to use by default for the cluster. Detailed below.
default_capacity_provider_strategy Configuration Block
capacityProvider
- (Required) Name of the capacity provider.weight
- (Optional) The relative percentage of the total number of launched tasks that should use the specified capacity provider. Theweight
value is taken into consideration after thebase
count of tasks has been satisfied. Defaults to0
.base
- (Optional) The number of tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined. Defaults to0
.
Attributes Reference
In addition to all arguments above, the following attributes are exported:
id
- Same asclusterName
.
Import
ECS cluster capacity providers can be imported using the clusterName
attribute. For example: