Skip to content

Commit

Permalink
fix(aws-cdk): check VpnGateways length in vpc provider
Browse files Browse the repository at this point in the history
Fixes aws#1998
  • Loading branch information
jogold committed Mar 13, 2019
1 parent 5d40377 commit c9a7b5c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/aws-cdk/lib/context-providers/vpcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ export class VpcNetworkContextProviderPlugin implements ContextProviderPlugin {
}
]
}).promise();
const vpnGatewayId = vpnGatewayResponse.VpnGateways ? vpnGatewayResponse.VpnGateways[0].VpnGatewayId : undefined;
const vpnGatewayId = vpnGatewayResponse.VpnGateways && vpnGatewayResponse.VpnGateways.length === 1
? vpnGatewayResponse.VpnGateways[0].VpnGatewayId
: undefined;

return {
vpcId,
Expand Down

0 comments on commit c9a7b5c

Please sign in to comment.