fix(ecs): reject negative desiredCount in CreateService and UpdateService (#1409)

This commit is contained in:
Konda Balaji Rao authored and GitHub committed 2026-06-19 00:24:11 -05:00
1 parent dbad78991d
commit 16b58b99c1
2 files changed
+70

No files matched your search

@@ -590,6 +590,9 @@ public class EcsService {
svc.setClusterArn(cluster.getClusterArn());
svc.setTaskDefinition(taskDefinition);
svc.setLaunchType(launchType != null ? launchType : LaunchType.FARGATE);
if (desiredCount < 0) {
throw new AwsException("InvalidParameterException", "desiredCount cannot be a negative number.", 400);
}
svc.setDesiredCount(desiredCount);
svc.setLoadBalancers(loadBalancers);
svc.setNetworkConfiguration(networkConfiguration);
@@ -623,6 +626,9 @@ public class EcsService {
"Service " + serviceName + " is not active.", 400);
}
if (desiredCount != null) {
if (desiredCount < 0) {
throw new AwsException("InvalidParameterException", "desiredCount cannot be a negative number.", 400);
}
svc.setDesiredCount(desiredCount);
}
if (networkConfiguration != null) {