Skip to content

Commit

Permalink
fix(elbv2): BaseLoadBalancer.vpc is not optional (#18474)
Browse files Browse the repository at this point in the history
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*
  • Loading branch information
Romain Marcadier committed Jan 18, 2022
1 parent 6b73d1d commit f511c17
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion allowed-breaking-changes.txt
Expand Up @@ -115,4 +115,9 @@ removed:@aws-cdk/aws-lambda-event-sources.SelfManagedKafkaEventSourceProps.retry
removed:@aws-cdk/aws-lambda-event-sources.SelfManagedKafkaEventSourceProps.tumblingWindow
base-types:@aws-cdk/aws-lambda-event-sources.KafkaEventSourceProps
base-types:@aws-cdk/aws-lambda-event-sources.ManagedKafkaEventSourceProps
base-types:@aws-cdk/aws-lambda-event-sources.SelfManagedKafkaEventSourceProps
base-types:@aws-cdk/aws-lambda-event-sources.SelfManagedKafkaEventSourceProps

# fixed vpc property of BaseLoadBalancer so it correctly implements I(Application|Network)LoadBalancer (i.e: must be optional)
changed-type:@aws-cdk/aws-elasticloadbalancingv2.ApplicationLoadBalancer.vpc
changed-type:@aws-cdk/aws-elasticloadbalancingv2.BaseLoadBalancer.vpc
changed-type:@aws-cdk/aws-elasticloadbalancingv2.NetworkLoadBalancer.vpc
Expand Up @@ -192,8 +192,11 @@ export abstract class BaseLoadBalancer extends Resource {

/**
* The VPC this load balancer has been created in.
*
* This property is always defined (not `null` or `undefined`) for sub-classes of `BaseLoadBalancer`.
*/
public readonly vpc: ec2.IVpc;
public readonly vpc?: ec2.IVpc;

/**
* Attributes set on this load balancer
*/
Expand Down

0 comments on commit f511c17

Please sign in to comment.