getRoute

suspend fun getRoute(argument: GetRoutePlainArgs): GetRouteResult

aws.ec2.Route provides details about a specific Route. This resource can prove useful when finding the resource associated with a CIDR. For example, finding the peering connection associated with a CIDR value.

Example Usage

The following example shows how one might use a CIDR value to find a network interface id and use this to create a data source of that network interface.

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetRouteTableArgs;
import com.pulumi.aws.ec2.inputs.GetRouteArgs;
import com.pulumi.aws.ec2.inputs.GetNetworkInterfaceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var config = ctx.config();
final var subnetId = config.get("subnetId");
final var selected = Ec2Functions.getRouteTable(GetRouteTableArgs.builder()
.subnetId(subnetId)
.build());
final var route = Ec2Functions.getRoute(GetRouteArgs.builder()
.routeTableId(aws_route_table.selected().id())
.destinationCidrBlock("10.0.1.0/24")
.build());
final var interface = Ec2Functions.getNetworkInterface(GetNetworkInterfaceArgs.builder()
.id(route.applyValue(getRouteResult -> getRouteResult.networkInterfaceId()))
.build());
}
}

Return

A collection of values returned by getRoute.

Parameters

argument

A collection of arguments for invoking getRoute.


suspend fun getRoute(carrierGatewayId: String? = null, coreNetworkArn: String? = null, destinationCidrBlock: String? = null, destinationIpv6CidrBlock: String? = null, destinationPrefixListId: String? = null, egressOnlyGatewayId: String? = null, gatewayId: String? = null, instanceId: String? = null, localGatewayId: String? = null, natGatewayId: String? = null, networkInterfaceId: String? = null, routeTableId: String, transitGatewayId: String? = null, vpcPeeringConnectionId: String? = null): GetRouteResult

Return

A collection of values returned by getRoute.

Parameters

carrierGatewayId

EC2 Carrier Gateway ID of the Route belonging to the Route Table.

coreNetworkArn

Core network ARN of the Route belonging to the Route Table.

destinationCidrBlock

CIDR block of the Route belonging to the Route Table.

destinationIpv6CidrBlock

IPv6 CIDR block of the Route belonging to the Route Table.

destinationPrefixListId

ID of a managed prefix list destination of the Route belonging to the Route Table.

egressOnlyGatewayId

Egress Only Gateway ID of the Route belonging to the Route Table.

gatewayId

Gateway ID of the Route belonging to the Route Table.

instanceId

Instance ID of the Route belonging to the Route Table.

localGatewayId

Local Gateway ID of the Route belonging to the Route Table.

natGatewayId

NAT Gateway ID of the Route belonging to the Route Table.

networkInterfaceId

Network Interface ID of the Route belonging to the Route Table.

routeTableId

ID of the specific Route Table containing the Route entry. The following arguments are optional:

transitGatewayId

EC2 Transit Gateway ID of the Route belonging to the Route Table.

vpcPeeringConnectionId

VPC Peering Connection ID of the Route belonging to the Route Table.

See also


suspend fun getRoute(argument: suspend GetRoutePlainArgsBuilder.() -> Unit): GetRouteResult

Return

A collection of values returned by getRoute.

Parameters

argument

Builder for com.pulumi.aws.ec2.kotlin.inputs.GetRoutePlainArgs.

See also