@@ -107,7 +107,6 @@ export class VpcConnector extends cdk.Resource implements IVpcConnector {
107
107
108
108
return new Import ( scope , id ) ;
109
109
}
110
- private readonly props : VpcConnectorProps ;
111
110
112
111
/**
113
112
* The ARN of the VPC connector.
@@ -133,23 +132,23 @@ export class VpcConnector extends cdk.Resource implements IVpcConnector {
133
132
public readonly connections : Connections
134
133
135
134
public constructor ( scope : Construct , id : string , props : VpcConnectorProps ) {
136
- super ( scope , id ) ;
137
-
138
- this . props = props ;
135
+ super ( scope , id , {
136
+ physicalName : props . vpcConnectorName ,
137
+ } ) ;
139
138
140
- const securityGroups = this . props . securityGroups ?. length ?
141
- this . props . securityGroups
142
- : [ new ec2 . SecurityGroup ( this , 'SecurityGroup' , { vpc : this . props . vpc } ) ] ;
139
+ const securityGroups = props . securityGroups ?. length ?
140
+ props . securityGroups
141
+ : [ new ec2 . SecurityGroup ( this , 'SecurityGroup' , { vpc : props . vpc } ) ] ;
143
142
144
143
const resource = new CfnVpcConnector ( this , 'Resource' , {
145
- subnets : this . props . vpc . selectSubnets ( this . props . vpcSubnets ?? { subnetType : ec2 . SubnetType . PRIVATE_WITH_NAT } ) . subnetIds ,
144
+ subnets : props . vpc . selectSubnets ( props . vpcSubnets ?? { subnetType : ec2 . SubnetType . PRIVATE_WITH_NAT } ) . subnetIds ,
146
145
securityGroups : securityGroups ?. map ( securityGroup => securityGroup . securityGroupId ) ,
147
- vpcConnectorName : this . props . vpcConnectorName ,
146
+ vpcConnectorName : this . physicalName ,
148
147
} ) ;
149
148
150
149
this . vpcConnectorArn = resource . attrVpcConnectorArn ;
151
150
this . vpcConnectorRevision = resource . attrVpcConnectorRevision ;
152
151
this . vpcConnectorName = resource . ref ;
153
- this . connections = new Connections ( { securityGroups } ) ; ;
152
+ this . connections = new Connections ( { securityGroups } ) ;
154
153
}
155
154
}
0 commit comments