Automate the entry and updating of routing information

Additionally, since we serve multiple customers and we will be re-using the code, variables are the way to go.I’ve also defined variables for both the VPCs in question.My first experience with Terraform was for sharing AMIs across accounts.Buoyed by the ease of building it out, I decided to try out completing a VPC peering connection request across 2 AWS accounts.While it’s not straightforward, it’s possible to get the account ID using the Amazon Resource Names (ARNs).

Route objects, in combination with the aut-num and other related objects, can be used to describe your routing policy in compact form.If you have a need to create a VPC, you can check out our github repo for creating a VPC.We need to create the peering request from the peering owner VPC, accept the peering connection request in the accepter account and update the route tables in both the VPCs with entries for the peering connection from either side.Some of the salient considerations to be kept in mind are to pass these at runtime, or as a .tfvars file.I have the option to hard-code credentials, but it is not a good security practice.

Leave a Reply