Skip to content

Commit

Permalink
fix(ec2): also add egress rules for allowInternally()
Browse files Browse the repository at this point in the history
This didn't use to be done, because upon initial testing
we probably had `allowAllOutbound: true`.

Add the appropriate calls to make this work when it is
set to `false` as well.

Fixes #3254.
  • Loading branch information
rix0rrr committed Aug 21, 2019
1 parent d8fcb50 commit 2a9abfe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions packages/@aws-cdk/aws-ec2/lib/connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ export class Connections implements IConnectable {
this._securityGroups.forEachAndForever(securityGroup => {
this._securityGroupRules.forEachAndForever(rule => {
securityGroup.addIngressRule(rule, portRange, description);
// FIXME: this seems required but we didn't use to have it. Research.
// securityGroup.addEgressRule(rule, portRange, description);
securityGroup.addEgressRule(rule, portRange, description);
});
});
}
Expand Down
7 changes: 7 additions & 0 deletions packages/@aws-cdk/aws-ec2/test/test.connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ export = {
ToPort: 88
}));

expect(stack).to(haveResource('AWS::EC2::SecurityGroupEgress', {
DestinationSecurityGroupId: { "Fn::GetAtt": [ "SecurityGroup1F554B36F", "GroupId" ] },
GroupId: { "Fn::GetAtt": [ "SecurityGroup1F554B36F", "GroupId" ] },
FromPort: 88,
ToPort: 88
}));

test.done();
},

Expand Down

0 comments on commit 2a9abfe

Please sign in to comment.