Skip to content

Resource: awsEc2TransitGatewayRoute

Manages an EC2 Transit Gateway Route.

Example Usage

Standard usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.ec2TransitGatewayRoute.Ec2TransitGatewayRoute(this, "example", {
  destinationCidrBlock: "0.0.0.0/0",
  transitGatewayAttachmentId:
    "${aws_ec2_transit_gateway_vpc_attachment.example.id}",
  transitGatewayRouteTableId:
    "${aws_ec2_transit_gateway.example.association_default_route_table_id}",
});

Blackhole route

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.ec2TransitGatewayRoute.Ec2TransitGatewayRoute(this, "example", {
  blackhole: true,
  destinationCidrBlock: "0.0.0.0/0",
  transitGatewayRouteTableId:
    "${aws_ec2_transit_gateway.example.association_default_route_table_id}",
});

Argument Reference

The following arguments are supported:

  • destinationCidrBlock - (Required) IPv4 or IPv6 RFC1924 CIDR used for destination matches. Routing decisions are based on the most specific match.
  • transitGatewayAttachmentId - (Optional) Identifier of EC2 Transit Gateway Attachment (required if blackhole is set to false).
  • blackhole - (Optional) Indicates whether to drop traffic that matches this route (default to false).
  • transitGatewayRouteTableId - (Required) Identifier of EC2 Transit Gateway Route Table.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - EC2 Transit Gateway Route Table identifier combined with destination

Import

awsEc2TransitGatewayRoute can be imported by using the EC2 Transit Gateway Route Table, an underscore, and the destination, e.g.,

$ terraform import aws_ec2_transit_gateway_route.example tgw-rtb-12345678_0.0.0.0/0