Skip to content

Commit 8f19b26

Browse files
authored
fix(elasticloadbalancingv2): fix incorrect max for minimumCapacityUnit (#34586)
### Issue Closes #34582 ### Reason for this change 1500 is a soft limit. We should only be checking the lower limit. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 3895d76 commit 8f19b26

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/alb/application-load-balancer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ export class ApplicationLoadBalancer extends BaseLoadBalancer implements IApplic
199199
if (
200200
minimumCapacityUnit &&
201201
!Token.isUnresolved(minimumCapacityUnit) &&
202-
(!Number.isInteger(minimumCapacityUnit) || minimumCapacityUnit < 100 || minimumCapacityUnit > 1500)
202+
(!Number.isInteger(minimumCapacityUnit) || minimumCapacityUnit < 100)
203203
) {
204-
throw new ValidationError(`'minimumCapacityUnit' must be a positive integer between 100 and 1500 for Application Load Balancer, got: ${minimumCapacityUnit}.`, this);
204+
throw new ValidationError(`'minimumCapacityUnit' must be a positive integer greater than or equal to 100 for Application Load Balancer, got: ${minimumCapacityUnit}.`, this);
205205
}
206206

207207
this.ipAddressType = props.ipAddressType ?? IpAddressType.IPV4;

packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/load-balancer.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('tests', () => {
2828
});
2929
});
3030

31-
test.each([-1, 99, 100.5, 1501])('throw error for invalid range minimum capacity unit', (minimumCapacityUnit) => {
31+
test.each([-1, 99, 100.5])('throw error for invalid range minimum capacity unit', (minimumCapacityUnit) => {
3232
// GIVEN
3333
const stack = new cdk.Stack();
3434
const vpc = new ec2.Vpc(stack, 'VPC');
@@ -40,7 +40,7 @@ describe('tests', () => {
4040
vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC },
4141
minimumCapacityUnit,
4242
});
43-
}).toThrow(`'minimumCapacityUnit' must be a positive integer between 100 and 1500 for Application Load Balancer, got: ${minimumCapacityUnit}.`);
43+
}).toThrow(`'minimumCapacityUnit' must be a positive integer greater than or equal to 100 for Application Load Balancer, got: ${minimumCapacityUnit}.`);
4444
});
4545

4646
test('Trivial construction: internet facing', () => {

0 commit comments

Comments
 (0)