This submodule is part of the the terraform-google-network
module. It creates the individual vpc routes and optionally deletes the default internet gateway routes.
It supports creating:
- Routes within vpc network.
- Optionally deletes the default internet gateway routes.
Basic usage of this submodule is as follows:
module "vpc" {
source = "terraform-google-modules/network/google//modules/routes"
version = "~> 2.0.0"
project_id = "<PROJECT ID>"
network_name = "example-vpc"
routes = [
{
name = "egress-internet"
description = "route through IGW to access internet"
destination_range = "0.0.0.0/0"
tags = "egress-inet"
next_hop_internet = "true"
},
{
name = "app-proxy"
description = "route through proxy to reach app"
destination_range = "10.50.10.0/24"
tags = "app-proxy"
next_hop_instance = "app-proxy-instance"
next_hop_instance_zone = "us-west1-a"
},
]
}
Name | Description | Type | Default | Required |
---|---|---|---|---|
module_depends_on | List of modules or resources this module depends on. | list(any) |
[] |
no |
network_name | The name of the network where routes will be created | string |
n/a | yes |
project_id | The ID of the project where the routes will be created | string |
n/a | yes |
routes | List of routes being created in this VPC | list(map(string)) |
[] |
no |
Name | Description |
---|---|
routes | The created routes resources |
The routes list contains maps, where each object represents a route. For the next_hop_* inputs, only one is possible to be used in each route. Having two next_hop_* inputs will produce an error. Each map has the following inputs (please see examples folder for additional references):
Name | Description | Type | Default | Required |
---|---|---|---|---|
name | The name of the route being created | string | - | no |
description | The description of the route being created | string | - | no |
tags | The network tags assigned to this route. This is a list in string format. Eg. "tag-01,tag-02" | string | - | yes |
destination_range | The destination range of outgoing packets that this route applies to. Only IPv4 is supported | string | - | yes |
next_hop_internet | Whether the next hop to this route will the default internet gateway. Use "true" to enable this as next hop | string | "false" |
yes |
next_hop_ip | Network IP address of an instance that should handle matching packets | string | - | yes |
next_hop_instance | URL or name of an instance that should handle matching packets. If just name is specified "next_hop_instance_zone" is required | string | - | yes |
next_hop_instance_zone | The zone of the instance specified in next_hop_instance. Only required if next_hop_instance is specified as a name | string | - | no |
next_hop_vpn_tunnel | URL to a VpnTunnel that should handle matching packets | string | - | yes |
next_hop_ilb | The URL to a forwarding rule of type loadBalancingScheme=INTERNAL that should handle matching packets. | string | - | no |
priority | The priority of this route. Priority is used to break ties in cases where there is more than one matching route of equal prefix length. In the case of two routes with equal prefix length, the one with the lowest-numbered priority value wins | string | "1000" |
yes |