I have written a module which traverses through an array of entries and created multiple vpc/tgw route tables etc. This module works great. I now have a need to add a direct connect route table/routes when this module is being called.
These resources have been created by hand and I would like to import them into my terraform state and when I do it it seems to work fine without any issues, but the next time I do a terraform plan it still shows up as a new resource to create rather than showing the existing stuff.
It goes through everything and finally tells me I am going to âaddâ this new tg_route_table rather than telling me there are no chances.
When I further let it move on rather cancel it, it creates this extra route table rather than adopting the existing one that is already created. Mind you this is not a big deal, I can delete the manually created and create it through terraform, but I do want to understand what I am doing wrong here.
I tried to import the route-table with the logical name âmorecrap-rtââ, terraform runs the import job to success, but in reality it is not present in the state file at all.
So why I apply the next time, it creates a route table with the logical name(inside tf) âmorecrap-rtâ but the existing route table that was created in the AWS console is still there.
May be I am not being clear here with my explanation.
If the plan requires -var-file to correctly set variables in the configuration to plan the resource you want to import, then the import command likely requires the same -var-file. Does importing work if you supply the same variable inputs?