Main Route Table Association
Provides a resource for managing the main routing table of a VPC.
NOTE: Do not use both
aws.ec2.DefaultRouteTableto manage a default route table andaws.ec2.MainRouteTableAssociationwith the same VPC due to possible route conflicts. See aws.ec2.DefaultRouteTable documentation for more details. For more information, see the Amazon VPC User Guide on Route Tables. For information about managing normal route tables in the provider, seeaws.ec2.RouteTable.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.MainRouteTableAssociation;
import com.pulumi.aws.ec2.MainRouteTableAssociationArgs;
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 mainRouteTableAssociation = new MainRouteTableAssociation("mainRouteTableAssociation", MainRouteTableAssociationArgs.builder()
.vpcId(aws_vpc.foo().id())
.routeTableId(aws_route_table.bar().id())
.build());
}
}Notes
On VPC creation, the AWS API always creates an initial Main Route Table. This resource records the ID of that Route Table under original_route_table_id. The "Delete" action for a main_route_table_association consists of resetting this original table as the Main Route Table for the VPC. You'll see this additional Route Table in the AWS console; it must remain intact in order for the main_route_table_association delete to work properly.