This template configures an ECS cluster capacity provider linked to an Auto Scaling Group, managing scaling and termination protection settings.

Terraform Template

resource "aws_autoscaling_group" "test" {

  tag {
    key = "AmazonECSManaged"
    propagate_at_launch = true
    value = "true"
  }
}

resource "aws_ecs_capacity_provider" "test" {

  auto_scaling_group_provider {
    auto_scaling_group_arn = aws_autoscaling_group.test.arn

    managed_scaling {
      maximum_scaling_step_size = 1000
      minimum_scaling_step_size = 1
      status = "ENABLED"
      target_capacity = 10
    }
    managed_termination_protection = "ENABLED"
  }
  name = "test"
}