Skip to content

Commit

Permalink
fix: nat eip empty (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-robot-in authored Mar 27, 2023
1 parent 2752ef0 commit a2ca736
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/constructs/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,19 @@ export class Network extends Construct {
'natEipAllocationIds and natSubnets length should be equal',
);
}
this.natProvider = ec2.NatProvider.gateway({
eipAllocationIds: props.natEipAllocationIds,
});

if (props.natEipAllocationIds?.length == this.natSubnets?.length) {
this.natProvider = ec2.NatProvider.gateway({
eipAllocationIds: props.natEipAllocationIds,
});
} else {
this.natProvider = ec2.NatProvider.gateway();
}

this.natProvider.configureNat({
vpc: this.vpc,
natSubnets: this.natSubnets,
privateSubnets: this.pvSubnets,

});
}
}
Expand Down

0 comments on commit a2ca736

Please sign in to comment.