Retrieving the route_table_id of an existing route table that I haven't created with terraform

I created a new VPC using this code

resource "aws_vpc" "main" {
  cidr_block = "10.0.0.0/16"
  enable_dns_hostnames = "true"
  
  tags = {
    Name = "MyVPC"
  }
}

This also created a route table, and now I want to add a route to it. As per the documentation, I should do it like this:

resource "aws_route" "r" {
  route_table_id            = "rtb-4fbb3ac4"
  destination_cidr_block    = "10.0.1.0/22"
  vpc_peering_connection_id = "pcx-45ff3dc1"
  depends_on                = [aws_route_table.testing]
}

But how can I retrieve the route_table_id of an existing route table that I haven’t created with terraform?

That will be the default route table, which you probably shouldn’t be using. Better to create your own route table for your own subnets.

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route_table

If you really want to there is now this resource to manage the default route table. Be sure the read the note on its use.

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/default_route_table