Merge pull request #309 from spulec/add-cloudformation-vpc-peering-connection
Add support to create AWS::EC2::VPCPeeringConnection through the CloudFormation interface
This commit is contained in:
commit
43cc48a80c
@ -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,
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user