Skip to content

@aws-cdk/aws-ecs-patterns: minScalingCapacity cannot be set to 0 #15632

@paya-cz

Description

@paya-cz

Reproduction Steps

It is impossible to set minScalingCapacity on a SQS-processing Fargate task to 0, because of this check:

this.minCapacity = props.minScalingCapacity || this.desiredCount;

The operator || treats 0 as a falsy value. Use ?? instead. A workaround seems to be to set desiredTaskCount deprecated prop to 0, since that's used in the falsy branch path.

What did you expect to happen?

minScalingCapacity set to 0 should deploy autoscaling with minimum tasks: 0.

What actually happened?

minScalingCapacity set to 0 deploys ECS autoscaling with minimum tasks: 1.

Environment

  • CDK CLI Version : 1.114.0 (build 7e41b6b)
  • Framework Version: 1.114.0
  • Node.js Version: v14.17.1
  • OS : Win 10
  • Language (Version): TypeScript (3.9.10)

This is 🐛 Bug Report

Metadata

Metadata

Labels

@aws-cdk/aws-ecs-patternsRelated to ecs-patterns librarybugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions