Help/advice on how to use ignore feature with AWS routes

Hi all

So i’m after advice or help with the ‘ignore feature’ on managing aws route rules.

current situation and design
So currently i have two git repositories which which basically each contain:

  • vpc
  • vpc igw
  • dhcp option set
  • subnets etc one per zone.
  • route-table, one per subnet
  • routes for the route-tables, we have one route-table per subnet
  • vpc peering
  • a bunch of ec2 instances

In this example i will refer as each git repository as Stack A and Stack B and each has its own remote terraform s3 state file, they are not shared.

So when i run/deploy Stack A, it creates the vpc and all underlining infrastructure into a workable state

Then i run Stack B which does the same and also creates a vpc peering link and routes to link Stack B vpc with Stack A vpc.

I use variables for the route-table id from Stack A in Stack B terraform run to automatically create the vpc peering PCX route in the Stack A route-table.

Current issue
Now if i re-run Stack A it will delete the pvc peering route as it wants to enforce state which is the problem i’m facing.

This means that other than creating the infrastructure from scratch, i cant use terraform to roll out future changes in Stack A and this is a simplified example but our environments are actually 10 separate stacks and we have multiple environments.

I have used the ignore feature before to ignore ec2 tags such as billing labels but i dont know how to correct use it on child resources by this i mean.

  • parent resources: aws route-table table
  • child resources: routes for the route-table

Any help would go a long way and if you need more information then please ask.

Thanks in advance.

Jared