support for carrier gateway in rt (#4282)

This commit is contained in:
Macwan Nevil 2021-09-12 13:15:38 +05:30 committed by GitHub
parent 39314906bc
commit d48cd31ebb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -4836,6 +4836,7 @@ class Route(CloudFormationModel):
transit_gateway=None,
interface=None,
vpc_pcx=None,
carrier_gateway=None,
):
self.id = generate_route_id(
route_table.id, destination_cidr_block, destination_ipv6_cidr_block
@ -4852,6 +4853,7 @@ class Route(CloudFormationModel):
self.transit_gateway = transit_gateway
self.interface = interface
self.vpc_pcx = vpc_pcx
self.carrier_gateway = carrier_gateway
@property
def physical_resource_id(self):
@ -5124,6 +5126,7 @@ class RouteBackend(object):
transit_gateway_id=None,
interface_id=None,
vpc_peering_connection_id=None,
carrier_gateway_id=None,
):
gateway = None
nat_gateway = None
@ -5131,6 +5134,7 @@ class RouteBackend(object):
egress_only_igw = None
interface = None
prefix_list = None
carrier_gateway = None
route_table = self.get_route_table(route_table_id)
@ -5159,6 +5163,8 @@ class RouteBackend(object):
transit_gateway = self.transit_gateways.get(transit_gateway_id)
if destination_prefix_list_id is not None:
prefix_list = self.managed_prefix_lists.get(destination_prefix_list_id)
if carrier_gateway_id is not None:
carrier_gateway = self.carrier_gateways.get(carrier_gateway_id)
route = Route(
route_table,
@ -5172,6 +5178,7 @@ class RouteBackend(object):
egress_only_igw=egress_only_igw,
transit_gateway=transit_gateway,
interface=interface,
carrier_gateway=carrier_gateway,
vpc_pcx=self.get_vpc_peering_connection(vpc_peering_connection_id)
if vpc_peering_connection_id
else None,

View File

@ -26,6 +26,7 @@ class RouteTables(BaseResponse):
transit_gateway_id = self._get_param("TransitGatewayId")
interface_id = self._get_param("NetworkInterfaceId")
pcx_id = self._get_param("VpcPeeringConnectionId")
carrier_gateway_id = self._get_param("CarrierGatewayId")
self.ec2_backend.create_route(
route_table_id,
@ -39,6 +40,7 @@ class RouteTables(BaseResponse):
transit_gateway_id=transit_gateway_id,
interface_id=interface_id,
vpc_peering_connection_id=pcx_id,
carrier_gateway_id=carrier_gateway_id,
)
template = self.response_template(CREATE_ROUTE_RESPONSE)
@ -215,6 +217,11 @@ DESCRIBE_ROUTE_TABLES_RESPONSE = """
<origin>CreateRoute</origin>
<state>blackhole</state>
{% endif %}
{% if route.carrier_gateway %}
<carrierGatewayId>{{ route.carrier_gateway.id }}</carrierGatewayId>
<origin>CreateRoute</origin>
<state>blackhole</state>
{% endif %}
{% if route.nat_gateway %}
<natGatewayId>{{ route.nat_gateway.id }}</natGatewayId>
<state>active</state>

View File

@ -99,7 +99,6 @@ TestAccAWSAPIGatewayStage_accessLogSettings_kinesis
TestAccAWSAPIGatewayStage_accessLogSettings
TestAccAWSRouteTable_ConditionalCidrBlock
TestAccAWSRouteTable_IPv4_To_Instance
TestAccAWSRouteTable_RequireRouteTarget
TestAccAWSRouteTable_Route_ConfigMode
TestAccAWSRouteTable_tags
TestAccAWSRouteTable_vgwRoutePropagation
@ -115,6 +114,7 @@ TestAccAWSRouteTable_basic
TestAccAWSRouteTable_MultipleRoutes
TestAccAWSRouteTable_PrefixList_To_InternetGateway
TestAccAWSRouteTable_VpcMultipleCidrs
TestAccAWSRouteTable_IPv4_To_CarrierGateway
TestAccAWSSsmDocumentDataSource
TestAccAwsEc2ManagedPrefixList
TestAccAWSEgressOnlyInternetGateway