Skip to content

Commit 736ea42

Browse files
committed
refractor vpc connector props
1 parent 26ec943 commit 736ea42

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

Diff for: packages/@aws-cdk/aws-apprunner/lib/vpc-connector.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ export class VpcConnector extends cdk.Resource implements IVpcConnector {
107107

108108
return new Import(scope, id);
109109
}
110-
private readonly props: VpcConnectorProps;
111110

112111
/**
113112
* The ARN of the VPC connector.
@@ -133,23 +132,23 @@ export class VpcConnector extends cdk.Resource implements IVpcConnector {
133132
public readonly connections: Connections
134133

135134
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+
});
139138

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 })];
143142

144143
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,
146145
securityGroups: securityGroups?.map(securityGroup => securityGroup.securityGroupId),
147-
vpcConnectorName: this.props.vpcConnectorName,
146+
vpcConnectorName: this.physicalName,
148147
});
149148

150149
this.vpcConnectorArn = resource.attrVpcConnectorArn;
151150
this.vpcConnectorRevision = resource.attrVpcConnectorRevision;
152151
this.vpcConnectorName = resource.ref;
153-
this.connections = new Connections({ securityGroups });;
152+
this.connections = new Connections({ securityGroups });
154153
}
155154
}

0 commit comments

Comments
 (0)