get Route
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
A collection of arguments for invoking getRoute.
Return
A collection of values returned by getRoute.
Parameters
EC2 Carrier Gateway ID of the Route belonging to the Route Table.
Core network ARN of the Route belonging to the Route Table.
CIDR block of the Route belonging to the Route Table.
IPv6 CIDR block of the Route belonging to the Route Table.
ID of a managed prefix list destination of the Route belonging to the Route Table.
Egress Only Gateway ID of the Route belonging to the Route Table.
Gateway ID of the Route belonging to the Route Table.
Instance ID of the Route belonging to the Route Table.
Local Gateway ID of the Route belonging to the Route Table.
NAT Gateway ID of the Route belonging to the Route Table.
Network Interface ID of the Route belonging to the Route Table.
ID of the specific Route Table containing the Route entry. The following arguments are optional:
EC2 Transit Gateway ID of the Route belonging to the Route Table.
VPC Peering Connection ID of the Route belonging to the Route Table.
See also
Return
A collection of values returned by getRoute.
Parameters
Builder for com.pulumi.aws.ec2.kotlin.inputs.GetRoutePlainArgs.