Skip to content

Commit

Permalink
chore(ec2): warn if egress rules are ignored (#9127)
Browse files Browse the repository at this point in the history
If `allowAllOutbound` is set to true, any call to `addEgressRule` will be ignored, this PR adds a warning. 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
NetaNir authored Jul 17, 2020
1 parent 1e16a7f commit 5191103
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-ec2/lib/security-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ export class SecurityGroup extends SecurityGroupBase {
// In the case of "allowAllOutbound", we don't add any more rules. There
// is only one rule which allows all traffic and that subsumes any other
// rule.
this.node.addWarning('Ignoring Egress rule since \'allowAllOutbound\' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup');
return;
} else {
// Otherwise, if the bogus rule exists we can now remove it because the
Expand Down

0 comments on commit 5191103

Please sign in to comment.