Skip to content

Commit

Permalink
chore(ec2): remove egress rule warning when using allowFrom() (aws#14677
Browse files Browse the repository at this point in the history
)

No need to warn the user if the `addEgressRule()` call came from a
`allowTo()` or ` allowFrom()` call because he can't do anything about
it.

Closes aws#13523


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
jogold authored and hollanddd committed Aug 26, 2021
1 parent 91b1e6f commit 940e240
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/@aws-cdk/aws-ec2/lib/security-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,9 @@ 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.
Annotations.of(this).addWarning('Ignoring Egress rule since \'allowAllOutbound\' is set to true; To add customize rules, set allowAllOutbound=false on the SecurityGroup');
if (!remoteRule) { // Warn only if addEgressRule() was explicitely called
Annotations.of(this).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 940e240

Please sign in to comment.