Hi, I have created 2 VPCs with Private Subnets in ...
# general
i
Hi, I have created 2 VPCs with Private Subnets in each. Now in future, is it possible to update Routes in a Route tables via pulumi- typescript so as to make a private subnet of VPC-A gets connected to a private subnet of VPC-B via a peering gateway ? I tried my hand with this already but I got few exceptions. So I am not sure if that is possible at all using "getRoutetable". Or is there any other way around. Thanks for any suggestions, help.
b
Yes it's possible. Can you share the code you have?
👍 1
l
You probably don't need to call getRouteTable. You just need to set up new routes.
i
@little-cartoon-10569 I tried that at first. I tried to add another route to an already existing route table with routes in a plainly declarative way and it kind of tried to created a new route table and i got exception as "cant create a new route table with same name".
l
Ah. If you want to add a route to an existing table, you need to use the existing route table's ID when creating the new route. You can you getRouteTable(), but you probably shouldn't. A better thing to do is to import the existing route table and start managing it from Pulumi.
i
Thanks @little-cartoon-10569 will try this and will share the result.
I think I should elaborate my case now... Project -1 : First I create "VPC-A" with a Private Subnet without any specific routes. Project - 2: Secondly I create another VPC "VPC-B" with a Public Subnet and 2 Private Subnets. Along with this I establish Peering Connection between these two VPCs and once the peering connection is made, new route tables get created so that the Private Subnets of "VPC B" can "ingress" into Private Subnets of "VPC A". So far so good. Now, I need to add routes to the Private Subnet of "VPC - A" to egress to Private Subnets of "VPC-B" via the "Peering gateway". Like this I may in future need to add more routes to an existing route table. Is this possible ? i am not trying to import already existing route table outside the pulumi stack. I tried different means and many times i got exception as "trying to create a new route table with an existing name, try give an unique name". Need a helping hand in this .
Hi, I solved this issue using getRouteTable() . I created the Route table as a separate project. So if I need to add Routes in the future, I can just add route table configuration code and "pulumi up" this Route table code file and not touch the main program. I earlier worked in the AWS AppConfig service where we separate the configuration files from the main code and then deploy them separately. I used that logic here and it worked.