awscc_ecs_cluster_capacity_provider_associations (Resource)

Associate a set of ECS Capacity Providers with a specified ECS Cluster

Example Usage

Default capacity provider strategy enabled

Manages the capacity providers of an ECS Cluster.

resource "awscc_ecs_cluster_capacity_provider_associations" "example" {
  cluster            = awscc_ecs_cluster.example.name
  capacity_providers = ["FARGATE", "FARGATE_SPOT"]

  default_capacity_provider_strategy = [{
    capacity_provider = "FARGATE"
    base = 1
    weight = 100

  }]
}

Auto Scaling group capacity provider

Manages the capacity providers of an ECS Cluster. Note that AWS Provider resource for aws_autoscaling_group is used.

resource "awscc_ecs_cluster_capacity_provider_associations" "example" {
  cluster            = awscc_ecs_cluster.example.name
  capacity_providers = [awscc_ecs_capacity_provider.example.id]
}

resource "awscc_ecs_capacity_provider" "example" {
  name = "example"

  auto_scaling_group_provider = {
    auto_scaling_group_arn         = aws_autoscaling_group.example.arn
    managed_termination_protection = "ENABLED"

    managed_scaling = {
      maximum_scaling_step_size = 1000
      minimum_scaling_step_size = 1
      status                    = "ENABLED"
      target_capacity           = 10
    }
  }
  lifecycle {
    ignore_changes = [auto_scaling_group_provider.auto_scaling_group_arn]
  }
}

Schema

Required

Read-Only

Nested Schema for default_capacity_provider_strategy

Required:

Optional:

Import

Import is supported using the following syntax:

$ terraform import awscc_ecs_cluster_capacity_provider_associations.example <resource ID>