Skip to content

Commit f511c17

Browse files
author
Romain Marcadier
authored
fix(elbv2): BaseLoadBalancer.vpc is not optional (#18474)
The `BaseLoadBalancer.vpc` property fulfills the `IApplicationLoadBalancer.vpc` and `INetworkLoadBalancer.vpc` properties, both of which are optional. A bug in `jsii` (see aws/jsii#3342) makes this pass type system consistency checks, when it should not be allowed. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 6b73d1d commit f511c17

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Diff for: allowed-breaking-changes.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,9 @@ removed:@aws-cdk/aws-lambda-event-sources.SelfManagedKafkaEventSourceProps.retry
115115
removed:@aws-cdk/aws-lambda-event-sources.SelfManagedKafkaEventSourceProps.tumblingWindow
116116
base-types:@aws-cdk/aws-lambda-event-sources.KafkaEventSourceProps
117117
base-types:@aws-cdk/aws-lambda-event-sources.ManagedKafkaEventSourceProps
118-
base-types:@aws-cdk/aws-lambda-event-sources.SelfManagedKafkaEventSourceProps
118+
base-types:@aws-cdk/aws-lambda-event-sources.SelfManagedKafkaEventSourceProps
119+
120+
# fixed vpc property of BaseLoadBalancer so it correctly implements I(Application|Network)LoadBalancer (i.e: must be optional)
121+
changed-type:@aws-cdk/aws-elasticloadbalancingv2.ApplicationLoadBalancer.vpc
122+
changed-type:@aws-cdk/aws-elasticloadbalancingv2.BaseLoadBalancer.vpc
123+
changed-type:@aws-cdk/aws-elasticloadbalancingv2.NetworkLoadBalancer.vpc

Diff for: packages/@aws-cdk/aws-elasticloadbalancingv2/lib/shared/base-load-balancer.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,11 @@ export abstract class BaseLoadBalancer extends Resource {
192192

193193
/**
194194
* The VPC this load balancer has been created in.
195+
*
196+
* This property is always defined (not `null` or `undefined`) for sub-classes of `BaseLoadBalancer`.
195197
*/
196-
public readonly vpc: ec2.IVpc;
198+
public readonly vpc?: ec2.IVpc;
199+
197200
/**
198201
* Attributes set on this load balancer
199202
*/

0 commit comments

Comments
 (0)