Package com.pulumi.aws.ec2
Class DefaultRouteTable
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.ec2.DefaultRouteTable
-
public class DefaultRouteTable extends com.pulumi.resources.CustomResource
Provides a resource to manage a default route table of a VPC. This resource can manage the default route table of the default or a non-default VPC. > **NOTE:** This is an advanced resource with special caveats. Please read this document in its entirety before using this resource. The `aws.ec2.DefaultRouteTable` resource behaves differently from normal resources. This provider does not _create_ this resource but instead attempts to "adopt" it into management. **Do not** use both `aws.ec2.DefaultRouteTable` to manage a default route table **and** `aws.ec2.MainRouteTableAssociation` with the same VPC due to possible route conflicts. See aws.ec2.MainRouteTableAssociation documentation for more details. Every VPC has a default route table that can be managed but not destroyed. When the provider first adopts a default route table, it **immediately removes all defined routes**. It then proceeds to create any routes specified in the configuration. This step is required so that only the routes specified in the configuration exist in the default route table. For more information, see the Amazon VPC User Guide on [Route Tables](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html). For information about managing normal route tables in this provider, see `aws.ec2.RouteTable`. ## Example Usage <!--Start PulumiCodeChooser --> ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.ec2.DefaultRouteTable; import com.pulumi.aws.ec2.DefaultRouteTableArgs; import com.pulumi.aws.ec2.inputs.DefaultRouteTableRouteArgs; 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) { var example = new DefaultRouteTable("example", DefaultRouteTableArgs.builder() .defaultRouteTableId(exampleAwsVpc.defaultRouteTableId()) .routes( DefaultRouteTableRouteArgs.builder() .cidrBlock("10.0.1.0/24") .gatewayId(exampleAwsInternetGateway.id()) .build(), DefaultRouteTableRouteArgs.builder() .ipv6CidrBlock("::/0") .egressOnlyGatewayId(exampleAwsEgressOnlyInternetGateway.id()) .build()) .tags(Map.of("Name", "example")) .build()); } } ``` <!--End PulumiCodeChooser --> To subsequently remove all managed routes: <!--Start PulumiCodeChooser --> ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.ec2.DefaultRouteTable; import com.pulumi.aws.ec2.DefaultRouteTableArgs; 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) { var example = new DefaultRouteTable("example", DefaultRouteTableArgs.builder() .defaultRouteTableId(exampleAwsVpc.defaultRouteTableId()) .routes() .tags(Map.of("Name", "example")) .build()); } } ``` <!--End PulumiCodeChooser --> ## Import Using `pulumi import`, import Default VPC route tables using the `vpc_id`. For example: ```sh $ pulumi import aws:ec2/defaultRouteTable:DefaultRouteTable example vpc-33cc44dd ```
-
-
Constructor Summary
Constructors Constructor Description DefaultRouteTable(java.lang.String name)
DefaultRouteTable(java.lang.String name, DefaultRouteTableArgs args)
DefaultRouteTable(java.lang.String name, DefaultRouteTableArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.lang.String>
arn()
com.pulumi.core.Output<java.lang.String>
defaultRouteTableId()
static DefaultRouteTable
get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, DefaultRouteTableState 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>
ownerId()
com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>>
propagatingVgws()
com.pulumi.core.Output<java.util.List<DefaultRouteTableRoute>>
routes()
com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>>
tags()
com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>>
tagsAll()
com.pulumi.core.Output<java.lang.String>
vpcId()
-
-
-
Constructor Detail
-
DefaultRouteTable
public DefaultRouteTable(java.lang.String name)
- Parameters:
name
- The _unique_ name of the resulting resource.
-
DefaultRouteTable
public DefaultRouteTable(java.lang.String name, DefaultRouteTableArgs args)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.
-
DefaultRouteTable
public DefaultRouteTable(java.lang.String name, DefaultRouteTableArgs 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
-
arn
public com.pulumi.core.Output<java.lang.String> arn()
- Returns:
- The ARN of the route table.
-
defaultRouteTableId
public com.pulumi.core.Output<java.lang.String> defaultRouteTableId()
- Returns:
- ID of the default route table. The following arguments are optional:
-
ownerId
public com.pulumi.core.Output<java.lang.String> ownerId()
- Returns:
- ID of the AWS account that owns the route table.
-
propagatingVgws
public com.pulumi.core.Output<java.util.Optional<java.util.List<java.lang.String>>> propagatingVgws()
- Returns:
- List of virtual gateways for propagation.
-
routes
public com.pulumi.core.Output<java.util.List<DefaultRouteTableRoute>> routes()
- Returns:
- Set of objects. Detailed below
-
tags
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>> tags()
- Returns:
- Map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
-
tagsAll
public com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>> tagsAll()
- Returns:
- A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.
-
vpcId
public com.pulumi.core.Output<java.lang.String> vpcId()
- Returns:
- ID of the VPC.
-
get
public static DefaultRouteTable get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable DefaultRouteTableState 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.
-
-