title: Route Propagation on AWS via Terraform
body: <p>My company uses AWS as a cloud provider and Terraform to do our Infrastructure as code piece.  I need to make a change to the way our traffic routes in AWS.  We currently have 1 NAT gateway. So if the AZ that this live sin went down we'd lose external connectivity from our instances that live on our private subnets.</p>
  
  <p>I've created 2 extra NAT GW's.  One in each AZ.  I have done all of this through Terraform ok but I've run into a stumbling block when it comes to the routing.  </p>
  
  <p>I've created this type of setup, where you have a routing table for both private and public subnets in each AZ</p>
  
  <p><a href="https://i.stack.imgur.com/4lv6K.png" rel="nofollow noreferrer">NAT GW Architecture and routing</a></p>
  
  <p>We have a Direct Connect and use BGP to advertise our Datacentre networks to AWS.  I can't seem to figure out how to enable route propagation on the private subnet route tables so that our on-prem networks get populated in these route tables.</p>
  
  <pre><code>resource "aws_route_table" "private-subnet-a-routes" {
      vpc_id = "${aws_vpc.foo.id}"
      propogating_vgws "${aws_vgw.foo.id}" 
  </code></pre>
  
  <p>I have tried that but get the below error</p>
  
  <ul>
  <li>resource 'aws_route_table.private-subnet-a-routes' config: unknown resource 'aws_vgw.foo' referenced in variable aws_vgw.foo.id</li>
  </ul>
  
  <p>Does anyone know how to set routes to be propagated on a route table from the main VGW in your VPC?</p>
  
  <p>Thanks in advance</p>
  
  <p>Chris</p>