Terraform provider reference / resources / router_port_forward

fiberax_router_port_forward (Resource)

One port forward of a ROUTER: traffic arriving on a public port of the router is sent to a server inside one of its private networks.

A forward is a resource of its own, addressed by its number on the router (priority), exactly like fiberax_router_firewall_rule. Forwards are checked in ascending number order and the first matching one wins; two forwards with overlapping public ports are both accepted, and the lower number applies - neither the platform nor the provider checks the overlap.

The public port may not cover the router's management port or the port of its WireGuard or OpenVPN tunnel (even a switched-off one), and the target must lie inside a private network attached to this router and must not be the router itself.

Example Usage

# Port forwards of a ROUTER: a public port of the router is sent to a server
# inside one of its private networks. The target must be inside a network
# attached to the router and must not be the router itself; the public port
# must not cover the router's management port or the port of its VPN tunnel.
resource "fiberax_router_port_forward" "ssh_to_app" {
  server_id   = fiberax_server.router.id
  public_port = "2222"
  target      = fiberax_server.app.private_ipv4 # 10.0.0.5
  target_port = "22"
  source      = "203.0.113.0/24" # who may use the forward; omit for anyone
  description = "ssh to the app server"
}

# A range on the same port, both protocols. target_port omitted: the traffic
# keeps the port it arrived on.
resource "fiberax_router_port_forward" "game" {
  server_id   = fiberax_server.router.id
  public_port = "27015-27020"
  protocol    = "tcp_udp"
  target      = "10.0.0.7"
  description = "game server"
}

Schema

Required

Optional

Read-Only

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# The import ID is the router's server ID and the forward number, separated by a comma.
terraform import fiberax_router_port_forward.ssh_to_app 11102,2000

Generated from the provider schema for version 0.3.0. How to install the provider: Terraform provider.