@@ -41,7 +41,7 @@ export interface NetworkLoadBalancerProps extends BaseLoadBalancerProps {
41
41
/**
42
42
* Indicates whether to evaluate inbound security group rules for traffic sent to a Network Load Balancer through AWS PrivateLink.
43
43
*
44
- * @default on
44
+ * @default true
45
45
*/
46
46
readonly enforceSecurityGroupInboundRulesOnPrivateLinkTraffic ?: boolean ;
47
47
}
@@ -208,8 +208,8 @@ export class NetworkLoadBalancer extends BaseLoadBalancer implements INetworkLoa
208
208
public readonly metrics : INetworkLoadBalancerMetrics ;
209
209
public readonly ipAddressType ?: IpAddressType ;
210
210
public readonly connections : ec2 . Connections ;
211
- public readonly enforceSecurityGroupInboundRulesOnPrivateLinkTraffic ?: string ;
212
211
private readonly isSecurityGroupsPropertyDefined : boolean ;
212
+ private readonly _enforceSecurityGroupInboundRulesOnPrivateLinkTraffic ?: boolean ;
213
213
214
214
/**
215
215
* After the implementation of `IConnectable` (see https://github.com/aws/aws-cdk/pull/28494), the default
@@ -229,7 +229,7 @@ export class NetworkLoadBalancer extends BaseLoadBalancer implements INetworkLoa
229
229
securityGroups : Lazy . list ( { produce : ( ) => this . securityGroups } ) ,
230
230
ipAddressType : props . ipAddressType ,
231
231
enforceSecurityGroupInboundRulesOnPrivateLinkTraffic : Lazy . string ( {
232
- produce : ( ) => this . transformEnforceSecurityGroupInboundRulesOnPrivateLinkTraffic ( props . enforceSecurityGroupInboundRulesOnPrivateLinkTraffic ) ,
232
+ produce : ( ) => this . enforceSecurityGroupInboundRulesOnPrivateLinkTraffic ,
233
233
} ) ,
234
234
} ) ;
235
235
@@ -238,15 +238,12 @@ export class NetworkLoadBalancer extends BaseLoadBalancer implements INetworkLoa
238
238
this . connections = new ec2 . Connections ( { securityGroups : props . securityGroups } ) ;
239
239
this . ipAddressType = props . ipAddressType ?? IpAddressType . IPV4 ;
240
240
if ( props . crossZoneEnabled ) { this . setAttribute ( 'load_balancing.cross_zone.enabled' , 'true' ) ; }
241
- this . enforceSecurityGroupInboundRulesOnPrivateLinkTraffic =
242
- this . transformEnforceSecurityGroupInboundRulesOnPrivateLinkTraffic ( props . enforceSecurityGroupInboundRulesOnPrivateLinkTraffic ) ;
241
+ this . _enforceSecurityGroupInboundRulesOnPrivateLinkTraffic = props . enforceSecurityGroupInboundRulesOnPrivateLinkTraffic ;
243
242
}
244
243
245
- private transformEnforceSecurityGroupInboundRulesOnPrivateLinkTraffic ( value : boolean | undefined ) : string | undefined {
246
- if ( value !== undefined ) {
247
- return value ? 'on' : 'off' ;
248
- }
249
- return undefined ;
244
+ public get enforceSecurityGroupInboundRulesOnPrivateLinkTraffic ( ) : string | undefined {
245
+ if ( this . _enforceSecurityGroupInboundRulesOnPrivateLinkTraffic === undefined ) return undefined ;
246
+ return this . _enforceSecurityGroupInboundRulesOnPrivateLinkTraffic ? 'on' : 'off' ;
250
247
}
251
248
252
249
/**
0 commit comments