Files
Mateusz Filipowicz b1688313c0 docs: improve provider documentation (#29)
* docs: improve provider documentation

* fix accidentally changed type of stormctrl_ucast_rate

* docs: add badges and plans to readme
2025-02-26 18:56:45 +01:00

3.3 KiB

page_title, subcategory, description
page_title subcategory description
unifi_static_route Resource - terraform-provider-unifi The unifi_static_route resource manages static routes on UniFi Security Gateways (USG) and UniFi Dream Machines (UDM/UDM-Pro). Static routes allow you to manually configure routing paths for specific networks. This is useful for: Connecting to networks not directly connected to your UniFi gatewayCreating backup routes for redundancyImplementing policy-based routingBlocking traffic to specific networks using blackhole routes Routes can be configured to use either a next-hop IP address, a specific interface, or as a blackhole route.

unifi_static_route (Resource)

The unifi_static_route resource manages static routes on UniFi Security Gateways (USG) and UniFi Dream Machines (UDM/UDM-Pro).

Static routes allow you to manually configure routing paths for specific networks. This is useful for:

  • Connecting to networks not directly connected to your UniFi gateway
  • Creating backup routes for redundancy
  • Implementing policy-based routing
  • Blocking traffic to specific networks using blackhole routes

Routes can be configured to use either a next-hop IP address, a specific interface, or as a blackhole route.

Example Usage

resource "unifi_static_route" "nexthop" {
  type     = "nexthop-route"
  network  = "172.17.0.0/16"
  name     = "basic nexthop"
  distance = 1
  next_hop = "172.16.0.1"
}

resource "unifi_static_route" "blackhole" {
  type     = "blackhole"
  network  = var.blackhole_cidr
  name     = "blackhole traffice to cidr"
  distance = 1
}

resource "unifi_static_route" "interface" {
  type      = "interface-route"
  network   = var.wan2_cidr
  name      = "send traffic over wan2"
  distance  = 1
  interface = "WAN2"
}

Schema

Required

  • distance (Number) The administrative distance for this route. Lower values are preferred. Use this to control route selection when multiple routes to the same destination exist.
  • name (String) A friendly name for the static route to help identify its purpose (e.g., 'Backup DC Link' or 'Cloud VPN Route').
  • network (String) The destination network in CIDR notation that this route will direct traffic to (e.g., '10.0.0.0/16' or '192.168.100.0/24').
  • type (String) The type of static route. Valid values are:
    • interface-route - Route traffic through a specific interface
    • nexthop-route - Route traffic to a specific next-hop IP address
    • blackhole - Drop all traffic to this network

Optional

  • interface (String) The outbound interface to use for this route. Only used when type is set to 'interface-route'. Can be:
    • WAN1 - Primary WAN interface
    • WAN2 - Secondary WAN interface
    • A network ID for internal networks
  • next_hop (String) The IP address of the next hop router for this route. Only used when type is set to 'nexthop-route'. This should be an IP address that is directly reachable from your UniFi gateway.
  • site (String) The name of the UniFi site where the static route should be created. If not specified, the default site will be used.

Read-Only

  • id (String) The unique identifier of the static route in the UniFi controller.