diff --git a/moto/cloudformation/parsing.py b/moto/cloudformation/parsing.py index e4117e839..4d3f53384 100644 --- a/moto/cloudformation/parsing.py +++ b/moto/cloudformation/parsing.py @@ -32,6 +32,7 @@ MODEL_MAP = { "AWS::EC2::VolumeAttachment": ec2_models.VolumeAttachment, "AWS::EC2::VPC": ec2_models.VPC, "AWS::EC2::VPCGatewayAttachment": ec2_models.VPCGatewayAttachment, + "AWS::EC2::VPCPeeringConnection": ec2_models.VPCPeeringConnection, "AWS::ElasticLoadBalancing::LoadBalancer": elb_models.FakeLoadBalancer, "AWS::IAM::InstanceProfile": iam_models.InstanceProfile, "AWS::IAM::Role": iam_models.Role, diff --git a/tests/test_cloudformation/test_cloudformation_stack_integration.py b/tests/test_cloudformation/test_cloudformation_stack_integration.py index 031ed464a..4b3cc20f5 100644 --- a/tests/test_cloudformation/test_cloudformation_stack_integration.py +++ b/tests/test_cloudformation/test_cloudformation_stack_integration.py @@ -984,3 +984,33 @@ def test_vpc_gateway_attachment_creation_should_attach_itself_to_vpc(): ) igws.should.have.length_of(1) + + +@mock_cloudformation +@mock_ec2 +def test_vpc_peering_creation(): + vpc_conn = boto.vpc.connect_to_region("us-west-1") + vpc_source = vpc_conn.create_vpc("10.0.0.0/16") + peer_vpc = vpc_conn.create_vpc("10.1.0.0/16") + template = { + "AWSTemplateFormatVersion": "2010-09-09", + "Resources": { + "vpcpeeringconnection": { + "Type": "AWS::EC2::VPCPeeringConnection", + "Properties": { + "PeerVpcId": peer_vpc.id, + "VpcId": vpc_source.id, + } + }, + } + } + + template_json = json.dumps(template) + cf_conn = boto.cloudformation.connect_to_region("us-west-1") + cf_conn.create_stack( + "test_stack", + template_body=template_json, + ) + + peering_connections = vpc_conn.get_all_vpc_peering_connections() + peering_connections.should.have.length_of(1)