title: How can I add route to VPC Gateway endpoint for AWS network firewall using terraform
body: <p>I am using Terraform to deploy AWS network firewall and getting below error.</p>
  <pre><code>Error: error creating route: InvalidParameterValue: route table rtb-060e56b4e1a9ea33c and interface eni-09505345a50ed2786 belong to different networks
      status code: 400, request id: b28dae26-ddec-42c0-b0d1-4443b224e55f
  
    on main.tf line 252, in resource &quot;aws_route_table&quot; &quot;tgw-inspection-RT&quot;:
   252: resource &quot;aws_route_table&quot; &quot;tgw-inspection-RT&quot; {
  </code></pre>
  <p>Below is a piece of code where i am trying to add a route so that TGW sends all traffic to AWS Network firewall VPC endpoint.</p>
  <pre><code>resource &quot;aws_route_table&quot; &quot;tgw-inspection-RT&quot; {
    provider = aws.region-master
    vpc_id = aws_vpc.inspection-vpc.id
      route {
      cidr_block = &quot;0.0.0.0/0&quot;
      network_interface_id = data.aws_network_interface.firewall-int.id
    }
    tags = {
      Name = &quot;tgw-inspection-RT&quot;
    }
  }
  </code></pre>
  <p>I tried to add using &quot;vpc_endpoint_id = aws_networkfirewall_firewall.terraform-anf.id&quot; but still got an error.</p>
  <p>I tried other ways as well as mentioned in below document but i am still getting an error.
  <a href="https://github.com/giuseppeborgese/terraform-aws-network-firewall-poc/blob/main/vpc.tf" rel="nofollow noreferrer">https://github.com/giuseppeborgese/terraform-aws-network-firewall-poc/blob/main/vpc.tf</a></p>
  <p>Any help will be appreciated !</p>