opnsense_route (Resource)

Routes can be used to teach your firewall which path it should take when forwarding packets to a specific network.

Example Usage

// Enabled with description
resource "opnsense_route" "one_route" {
  description = "Example route"
  gateway = "LAN_DHCP"
  network = "10.9.0.0/24"
}

// Disabled without description
resource "opnsense_route" "two_route" {
  enabled = false

  gateway = "LAN"
  network = "10.10.0.0/24"
}

Schema

Required

  • gateway (String) Which gateway this route applies, e.g. WAN. Must be an existing gateway.
  • network (String) Destination network for this static route.

Optional

  • description (String) Optional description here for your reference (not parsed).
  • enabled (Boolean) Enable this route. Defaults to true.

Read-Only

  • id (String) UUID of the route.

Import

In Terraform v1.5.0 and later, use an import block to import opnsense_route using the id. For example:

import {
  to = opnsense_route.example
  id = "<opnsense-resource-id>"
}

Using terraform import, import opnsense_route using the id. For example:

% terraform import opnsense_route.example <opnsense-resource-id>