Repository: getmoto/moto

Issue:
Tags specified in Cloudformation aren't applied to EC2 instances
Probably related to #320.

Diff for a failing test case:

```diff
diff --git a/tests/test_cloudformation/test_cloudformation_stack_integration.py b/tests/test_cloudformation/test_cloudformation_stack_integration.py
index 4237bee..ae8e831 100644
--- a/tests/test_cloudformation/test_cloudformation_stack_integration.py
+++ b/tests/test_cloudformation/test_cloudformation_stack_integration.py
@@ -676,6 +676,7 @@ def test_vpc_single_instance_in_subnet():
     ec2_conn = boto.ec2.connect_to_region("us-west-1")
     reservation = ec2_conn.get_all_instances()[0]
     instance = reservation.instances[0]
+    assert instance.tags["Application"]
     # Check that the EIP is attached the the EC2 instance
     eip = ec2_conn.get_all_addresses()[0]
     eip.domain.should.equal('vpc')
```


Discussion:

Resolving patch:
diff --git a/moto/ec2/models.py b/moto/ec2/models.py
--- a/moto/ec2/models.py
+++ b/moto/ec2/models.py
@@ -336,7 +336,7 @@ def get_all_network_interfaces(self, eni_ids=None, filters=None):
         return generic_filter(filters, enis)
 
 
-class Instance(BotoInstance, TaggedEC2Resource):
+class Instance(TaggedEC2Resource, BotoInstance):
     def __init__(self, ec2_backend, image_id, user_data, security_groups, **kwargs):
         super(Instance, self).__init__()
         self.ec2_backend = ec2_backend
@@ -441,7 +441,10 @@ def create_from_cloudformation_json(cls, resource_name, cloudformation_json, reg
             key_name=properties.get("KeyName"),
             private_ip=properties.get('PrivateIpAddress'),
         )
-        return reservation.instances[0]
+        instance = reservation.instances[0]
+        for tag in properties.get("Tags", []):
+            instance.add_tag(tag["Key"], tag["Value"])
+        return instance
 
     @property
     def physical_resource_id(self):


Test patch:
diff --git a/tests/test_cloudformation/fixtures/vpc_single_instance_in_subnet.py b/tests/test_cloudformation/fixtures/vpc_single_instance_in_subnet.py
--- a/tests/test_cloudformation/fixtures/vpc_single_instance_in_subnet.py
+++ b/tests/test_cloudformation/fixtures/vpc_single_instance_in_subnet.py
@@ -236,6 +236,10 @@
                             "Ref": "AWS::StackId"
                         },
                         "Key": "Application"
+                    },
+                    {
+                        "Value": "Bar",
+                        "Key": "Foo"
                     }
                 ],
                 "SecurityGroupIds": [
diff --git a/tests/test_cloudformation/test_cloudformation_stack_integration.py b/tests/test_cloudformation/test_cloudformation_stack_integration.py
--- a/tests/test_cloudformation/test_cloudformation_stack_integration.py
+++ b/tests/test_cloudformation/test_cloudformation_stack_integration.py
@@ -676,6 +676,7 @@ def test_vpc_single_instance_in_subnet():
     ec2_conn = boto.ec2.connect_to_region("us-west-1")
     reservation = ec2_conn.get_all_instances()[0]
     instance = reservation.instances[0]
+    instance.tags["Foo"].should.equal("Bar")
     # Check that the EIP is attached the the EC2 instance
     eip = ec2_conn.get_all_addresses()[0]
     eip.domain.should.equal('vpc')