How to force terraform to update custom transit gateway route table instead of default

I have the following code:

resource "aws_ec2_transit_gateway_route_table" "non_default" {
 transit_gateway_id = "${}"

resource "aws_ec2_transit_gateway_route_table_association" "non_default_association" {
  transit_gateway_attachment_id  = "${aws_vpn_connection.tgw-vpn-attachment.transit_gateway_attachment_id}"
  transit_gateway_route_table_id = "${}"
  depends_on = ["aws_vpn_connection.tgw-vpn-attachment"]

# Name default route table — This is not working either.
resource "aws_default_route_table" "default" {
  default_route_table_id = "${}"

  tags = {
    Name = "HelloWorld"

I want it to associate the VPN gateway attachment to the non-default table. But when I run the above code it adds it to default route table? I need a default route table and don’t want to disable it. How can I achieve the above results?

Also when I try to add name tag to default route table that is not working as well.

Use the resource “aws_route_table” rather than “aws_default_route_table”


I tried this:
resource “aws_route_table” “default” {
transit_gateway_id = “${}”

  tags = {
    Name = "HelloWorld"

Its not working. Getting following errors:
Error: aws_route_table.default: “vpc_id”: required field is not set
Error: aws_route_table.default: : invalid or unknown key: transit_gateway_id

Also main question was how can I update custom route table instead of default. If I am not able to change name of default that is not a big issue.


For the resource aws_ec2_transit_gateway there are a few options

  • default_route_table_association - (Optional) Whether resource attachments are automatically associated with the default association route table. Valid values: disable , enable . Default value: enable .
  • default_route_table_propagation - (Optional) Whether resource attachments automatically propagate routes to the default propagation route table. Valid values: disable , enable . Default value: enable .

Problem is these options cannot be applied to the route table itself. You can only apply this option to the transit gateway which does not help with the situation??