From cfaaa70ea99a229a8daf6d7376e48fd523323a49 Mon Sep 17 00:00:00 2001 From: usmangani1 Date: Sun, 6 Dec 2020 05:34:46 +0530 Subject: [PATCH] FIX:Ec2:Added:Tags for EIP (#3505) * FIX:Ec2:Added:Tags for EIP * removed files * Fix tests --- moto/ec2/models.py | 4 +++- moto/ec2/responses/elastic_ip_addresses.py | 10 ++++++++++ tests/test_ec2/test_elastic_ip_addresses.py | 15 +++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/moto/ec2/models.py b/moto/ec2/models.py index eaef6cbd6..e3e55cad7 100644 --- a/moto/ec2/models.py +++ b/moto/ec2/models.py @@ -226,7 +226,9 @@ class StateReason(object): class TaggedEC2Resource(BaseModel): def get_tags(self, *args, **kwargs): - tags = self.ec2_backend.describe_tags(filters={"resource-id": [self.id]}) + tags = [] + if self.id: + tags = self.ec2_backend.describe_tags(filters={"resource-id": [self.id]}) return tags def add_tag(self, key, value): diff --git a/moto/ec2/responses/elastic_ip_addresses.py b/moto/ec2/responses/elastic_ip_addresses.py index e25922706..0cf549a83 100644 --- a/moto/ec2/responses/elastic_ip_addresses.py +++ b/moto/ec2/responses/elastic_ip_addresses.py @@ -151,6 +151,16 @@ DESCRIBE_ADDRESS_RESPONSE = """