Improve ec2:DescribeSubnets filtering (#3457)

* Add response/model/test coverage for filtering by `state`
* Add explicit test case for filtering by `vpc-id`

Closes #801
This commit is contained in:
Brian Pandola 2020-11-16 00:17:36 -08:00 committed by GitHub
commit 93453eba05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 1 deletions

View file

@ -3307,6 +3307,7 @@ class Subnet(TaggedEC2Resource, CloudFormationModel):
] # Reserved by AWS
self._unused_ips = set() # if instance is destroyed hold IP here for reuse
self._subnet_ips = {} # has IP: instance
self.state = "available"
@staticmethod
def cloudformation_name_type():
@ -3387,6 +3388,8 @@ class Subnet(TaggedEC2Resource, CloudFormationModel):
return self.availability_zone
elif filter_name in ("defaultForAz", "default-for-az"):
return self.default_for_az
elif filter_name == "state":
return self.state
else:
return super(Subnet, self).get_filter_value(filter_name, "DescribeSubnets")