diff --git a/moto/ec2/models/network_acls.py b/moto/ec2/models/network_acls.py index a3d9de4ab..6ebf9a6f2 100644 --- a/moto/ec2/models/network_acls.py +++ b/moto/ec2/models/network_acls.py @@ -238,6 +238,8 @@ class NetworkAcl(TaggedEC2Resource): return [entry.rule_number for entry in self.network_acl_entries] elif filter_name == "entry.rule-action": return [entry.rule_action for entry in self.network_acl_entries] + elif filter_name == "entry.egress": + return [entry.egress for entry in self.network_acl_entries] elif filter_name == "owner-id": return self.owner_id else: diff --git a/tests/test_ec2/test_network_acls.py b/tests/test_ec2/test_network_acls.py index 63f707fd7..6f777bef3 100644 --- a/tests/test_ec2/test_network_acls.py +++ b/tests/test_ec2/test_network_acls.py @@ -385,6 +385,21 @@ def test_describe_network_acls(): ) resp4["NetworkAcls"].should.have.length_of(0) + # Ensure filtering by egress flag + resp4 = conn.describe_network_acls( + Filters=[{"Name": "entry.egress", "Values": ["false"]}] + ) + [entry["NetworkAclId"] for entry in resp4["NetworkAcls"]].should.contain( + network_acl_id + ) + # the ACL with network_acl_id contains no entries with Egress=True + resp4 = conn.describe_network_acls( + Filters=[{"Name": "entry.egress", "Values": ["true"]}] + ) + [entry["NetworkAclId"] for entry in resp4["NetworkAcls"]].shouldnt.contain( + network_acl_id + ) + # Ensure filtering by rule action resp4 = conn.describe_network_acls( Filters=[