Merge pull request #1417 from goraxe/cloudformation_vpc_add_tags

Cloudformation vpc add tags
This commit is contained in:
Jack Danger 2017-12-28 12:03:17 -08:00 committed by GitHub
commit 948a7ac06f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -2004,6 +2004,11 @@ class VPC(TaggedEC2Resource):
cidr_block=properties['CidrBlock'],
instance_tenancy=properties.get('InstanceTenancy', 'default')
)
for tag in properties.get("Tags", []):
tag_key = tag["Key"]
tag_value = tag["Value"]
vpc.add_tag(tag_key, tag_value)
return vpc
@property

View File

@ -752,6 +752,9 @@ def test_vpc_single_instance_in_subnet():
security_group.vpc_id.should.equal(vpc.id)
stack = conn.describe_stacks()[0]
vpc.tags.should.have.key('Application').which.should.equal(stack.stack_id)
resources = stack.describe_resources()
vpc_resource = [
resource for resource in resources if resource.resource_type == 'AWS::EC2::VPC'][0]