Package com.pulumi.aws.ec2
Class Route
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.ec2.Route
-
public class Route extends com.pulumi.resources.CustomResourceProvides a resource to create a routing table entry (a route) in a VPC routing table. > **NOTE on `gatewayId` attribute:** The AWS API is very forgiving with the resource ID passed in the `gatewayId` attribute. For example an `aws.ec2.Route` resource can be created with an `aws.ec2.NatGateway` or `aws.ec2.EgressOnlyInternetGateway` ID specified for the `gatewayId` attribute. Specifying anything other than an `aws.ec2.InternetGateway` or `aws.ec2.VpnGateway` ID will lead to this provider reporting a permanent diff between your configuration and recorded state, as the AWS API returns the more-specific attribute. If you are experiencing constant diffs with an `aws.ec2.Route` resource, the first thing to check is that the correct attribute is being specified. > **NOTE on combining `vpcEndpointId` and `destinationPrefixListId` attributes:** To associate a Gateway VPC Endpoint (such as S3) with destination prefix list, use the `aws.ec2.VpcEndpointRouteTableAssociation` resource instead. ## Example Usage
### Example IPv6 Usagepackage generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.ec2.Route; import com.pulumi.aws.ec2.RouteArgs; import java.util.ArrayList; import java.util.Arrays; 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) { var r = new Route("r", RouteArgs.builder() .routeTableId(testing.id()) .destinationCidrBlock("10.0.1.0/22") .vpcPeeringConnectionId("pcx-45ff3dc1") .build()); } }
## Import ### Identity Schema #### Required * `routeTableId` - (String) ID of the route table. #### Optional > Exactly one of of `destinationCidrBlock`, `destinationIpv6CidrBlock`, or `destinationPrefixListId` is required. * `accountId` (String) AWS Account where this resource is managed. * `destinationCidrBlock` - (String) Destination IPv4 CIDR block. * `destinationIpv6CidrBlock` - (String) Destination IPv6 CIDR block. * `destinationPrefixListId` - (String) Destination IPv6 CIDR block. * `region` (String) Region where this resource is managed. Import a route in route table `rtb-656C65616E6F72` with an IPv6 destination CIDR of `2620:0:2d0:200::8/125`: Import a route in route table `rtb-656C65616E6F72` with a managed prefix list destination of `pl-0570a1d2d725c16be`: **Using `pulumi import` to import** individual routes using `ROUTETABLEID_DESTINATION`. Import [local routes](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html#RouteTables) using the VPC's IPv4 or IPv6 CIDR blocks. For example: Import a route in route table `rtb-656C65616E6F72` with an IPv4 destination CIDR of `10.42.0.0/16`: ```sh $ pulumi import aws:ec2/route:Route my_route rtb-656C65616E6F72_10.42.0.0/16 ``` Import a route in route table `rtb-656C65616E6F72` with an IPv6 destination CIDR of `2620:0:2d0:200::8/125`: ```sh $ pulumi import aws:ec2/route:Route my_route rtb-656C65616E6F72_2620:0:2d0:200::8/125 ``` Import a route in route table `rtb-656C65616E6F72` with a managed prefix list destination of `pl-0570a1d2d725c16be`: ```sh $ pulumi import aws:ec2/route:Route my_route rtb-656C65616E6F72_pl-0570a1d2d725c16be ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.ec2.Vpc; import com.pulumi.aws.ec2.VpcArgs; import com.pulumi.aws.ec2.EgressOnlyInternetGateway; import com.pulumi.aws.ec2.EgressOnlyInternetGatewayArgs; import com.pulumi.aws.ec2.Route; import com.pulumi.aws.ec2.RouteArgs; import java.util.ArrayList; import java.util.Arrays; 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) { var vpc = new Vpc("vpc", VpcArgs.builder() .cidrBlock("10.1.0.0/16") .assignGeneratedIpv6CidrBlock(true) .build()); var egress = new EgressOnlyInternetGateway("egress", EgressOnlyInternetGatewayArgs.builder() .vpcId(vpc.id()) .build()); var r = new Route("r", RouteArgs.builder() .routeTableId("rtb-4fbb3ac4") .destinationIpv6CidrBlock("::/0") .egressOnlyGatewayId(egress.id()) .build()); } }
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.util.Optional<java.lang.String>>carrierGatewayId()com.pulumi.core.Output<java.util.Optional<java.lang.String>>coreNetworkArn()com.pulumi.core.Output<java.util.Optional<java.lang.String>>destinationCidrBlock()com.pulumi.core.Output<java.util.Optional<java.lang.String>>destinationIpv6CidrBlock()com.pulumi.core.Output<java.util.Optional<java.lang.String>>destinationPrefixListId()com.pulumi.core.Output<java.util.Optional<java.lang.String>>egressOnlyGatewayId()com.pulumi.core.Output<java.util.Optional<java.lang.String>>gatewayId()static Routeget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, RouteState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>instanceId()com.pulumi.core.Output<java.lang.String>instanceOwnerId()com.pulumi.core.Output<java.util.Optional<java.lang.String>>localGatewayId()com.pulumi.core.Output<java.util.Optional<java.lang.String>>natGatewayId()com.pulumi.core.Output<java.lang.String>networkInterfaceId()com.pulumi.core.Output<java.util.Optional<java.lang.String>>odbNetworkArn()com.pulumi.core.Output<java.lang.String>origin()com.pulumi.core.Output<java.lang.String>region()com.pulumi.core.Output<java.lang.String>routeTableId()com.pulumi.core.Output<java.lang.String>state()com.pulumi.core.Output<java.util.Optional<java.lang.String>>transitGatewayId()com.pulumi.core.Output<java.util.Optional<java.lang.String>>vpcEndpointId()com.pulumi.core.Output<java.util.Optional<java.lang.String>>vpcPeeringConnectionId()
-
-
-
Constructor Detail
-
Route
public Route(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
Route
public Route(java.lang.String name, RouteArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
Route
public Route(java.lang.String name, RouteArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
carrierGatewayId
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> carrierGatewayId()
- Returns:
- Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone.
-
coreNetworkArn
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> coreNetworkArn()
- Returns:
- ARN of a core network.
-
destinationCidrBlock
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> destinationCidrBlock()
- Returns:
- The destination CIDR block.
-
destinationIpv6CidrBlock
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> destinationIpv6CidrBlock()
- Returns:
- The destination IPv6 CIDR block.
-
destinationPrefixListId
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> destinationPrefixListId()
- Returns:
- The ID of a managed prefix list destination. One of the following target arguments must be supplied:
-
egressOnlyGatewayId
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> egressOnlyGatewayId()
- Returns:
- Identifier of a VPC Egress Only Internet Gateway.
-
gatewayId
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> gatewayId()
- Returns:
- Identifier of a VPC internet gateway or a virtual private gateway. Specify `local` when updating a previously imported local route.
-
instanceId
public com.pulumi.core.Output<java.lang.String> instanceId()
- Returns:
- Identifier of an EC2 instance.
-
instanceOwnerId
public com.pulumi.core.Output<java.lang.String> instanceOwnerId()
- Returns:
- The AWS account ID of the owner of the EC2 instance.
-
localGatewayId
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> localGatewayId()
- Returns:
- Identifier of a Outpost local gateway.
-
natGatewayId
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> natGatewayId()
- Returns:
- Identifier of a VPC NAT gateway.
-
networkInterfaceId
public com.pulumi.core.Output<java.lang.String> networkInterfaceId()
- Returns:
- Identifier of an EC2 network interface.
-
odbNetworkArn
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> odbNetworkArn()
- Returns:
- ARN of an ODB network.
-
origin
public com.pulumi.core.Output<java.lang.String> origin()
- Returns:
- How the route was created - `CreateRouteTable`, `CreateRoute` or `EnableVgwRoutePropagation`.
-
region
public com.pulumi.core.Output<java.lang.String> region()
- Returns:
- Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
-
routeTableId
public com.pulumi.core.Output<java.lang.String> routeTableId()
- Returns:
- The ID of the routing table. One of the following destination arguments must be supplied:
-
state
public com.pulumi.core.Output<java.lang.String> state()
- Returns:
- The state of the route - `active` or `blackhole`.
-
transitGatewayId
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> transitGatewayId()
- Returns:
- Identifier of an EC2 Transit Gateway.
-
vpcEndpointId
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> vpcEndpointId()
- Returns:
- Identifier of a VPC Endpoint.
-
vpcPeeringConnectionId
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> vpcPeeringConnectionId()
- Returns:
- Identifier of a VPC peering connection. Note that the default route, mapping the VPC's CIDR block to "local", is created implicitly and cannot be specified.
-
get
public static Route get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable RouteState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-