The unifi.port.Forward resource manages port forwarding rules on UniFi controllers.
Port forwarding allows external traffic to reach services hosted on your internal network by mapping external ports to internal IP addresses and ports. This is commonly used for:
- Hosting web servers, game servers, or other services
- Remote access to internal services
- Application-specific requirements
Each rule can be configured with source IP restrictions, protocol selection, and logging options for enhanced security and monitoring.
Create Forward Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Forward(name: string, args?: ForwardArgs, opts?: CustomResourceOptions);@overload
def Forward(resource_name: str,
args: Optional[ForwardArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def Forward(resource_name: str,
opts: Optional[ResourceOptions] = None,
dst_port: Optional[str] = None,
enabled: Optional[bool] = None,
fwd_ip: Optional[str] = None,
fwd_port: Optional[str] = None,
log: Optional[bool] = None,
name: Optional[str] = None,
port_forward_interface: Optional[str] = None,
protocol: Optional[str] = None,
site: Optional[str] = None,
src_ip: Optional[str] = None)func NewForward(ctx *Context, name string, args *ForwardArgs, opts ...ResourceOption) (*Forward, error)public Forward(string name, ForwardArgs? args = null, CustomResourceOptions? opts = null)
public Forward(String name, ForwardArgs args)
public Forward(String name, ForwardArgs args, CustomResourceOptions options)
type: unifi:port:Forward
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ForwardArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args ForwardArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ForwardArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ForwardArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ForwardArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var forwardResource = new Unifi.Port.Forward("forwardResource", new()
{
DstPort = "string",
FwdIp = "string",
FwdPort = "string",
Log = false,
Name = "string",
PortForwardInterface = "string",
Protocol = "string",
Site = "string",
SrcIp = "string",
});
example, err := port.NewForward(ctx, "forwardResource", &port.ForwardArgs{
DstPort: pulumi.String("string"),
FwdIp: pulumi.String("string"),
FwdPort: pulumi.String("string"),
Log: pulumi.Bool(false),
Name: pulumi.String("string"),
PortForwardInterface: pulumi.String("string"),
Protocol: pulumi.String("string"),
Site: pulumi.String("string"),
SrcIp: pulumi.String("string"),
})
var forwardResource = new Forward("forwardResource", ForwardArgs.builder()
.dstPort("string")
.fwdIp("string")
.fwdPort("string")
.log(false)
.name("string")
.portForwardInterface("string")
.protocol("string")
.site("string")
.srcIp("string")
.build());
forward_resource = unifi.port.Forward("forwardResource",
dst_port="string",
fwd_ip="string",
fwd_port="string",
log=False,
name="string",
port_forward_interface="string",
protocol="string",
site="string",
src_ip="string")
const forwardResource = new unifi.port.Forward("forwardResource", {
dstPort: "string",
fwdIp: "string",
fwdPort: "string",
log: false,
name: "string",
portForwardInterface: "string",
protocol: "string",
site: "string",
srcIp: "string",
});
type: unifi:port:Forward
properties:
dstPort: string
fwdIp: string
fwdPort: string
log: false
name: string
portForwardInterface: string
protocol: string
site: string
srcIp: string
Forward Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Forward resource accepts the following input properties:
- Dst
Port string - The external port(s) that will be forwarded. Can be a single port (e.g., '80') or a port range (e.g., '8080:8090').
- Enabled bool
- Specifies whether the port forwarding rule is enabled or not.
- Fwd
Ip string - The internal IPv4 address of the device or service that will receive the forwarded traffic (e.g., '192.168.1.100').
- Fwd
Port string - The internal port(s) that will receive the forwarded traffic. Can be a single port (e.g., '8080') or a port range (e.g., '8080:8090').
- Log bool
- Enable logging of traffic matching this port forwarding rule. Useful for monitoring and troubleshooting.
- Name string
- A friendly name for the port forwarding rule to help identify its purpose (e.g., 'Web Server' or 'Game Server').
- Port
Forward stringInterface - The WAN interface to apply the port forwarding rule to. Valid values are:
wan- Primary WAN interfacewan2- Secondary WAN interfaceboth- Both WAN interfaces
- Protocol string
- The network protocol(s) this rule applies to. Valid values are:
tcp_udp- Both TCP and UDP (default)tcp- TCP onlyudp- UDP only
- Site string
- The name of the UniFi site where the port forwarding rule should be created. If not specified, the default site will be used.
- Src
Ip string - The source IP address or network in CIDR notation that is allowed to use this port forward. Use 'any' to allow all source IPs. Examples: '203.0.113.1' for a single IP, '203.0.113.0/24' for a network, or 'any' for all IPs.
- Dst
Port string - The external port(s) that will be forwarded. Can be a single port (e.g., '80') or a port range (e.g., '8080:8090').
- Enabled bool
- Specifies whether the port forwarding rule is enabled or not.
- Fwd
Ip string - The internal IPv4 address of the device or service that will receive the forwarded traffic (e.g., '192.168.1.100').
- Fwd
Port string - The internal port(s) that will receive the forwarded traffic. Can be a single port (e.g., '8080') or a port range (e.g., '8080:8090').
- Log bool
- Enable logging of traffic matching this port forwarding rule. Useful for monitoring and troubleshooting.
- Name string
- A friendly name for the port forwarding rule to help identify its purpose (e.g., 'Web Server' or 'Game Server').
- Port
Forward stringInterface - The WAN interface to apply the port forwarding rule to. Valid values are:
wan- Primary WAN interfacewan2- Secondary WAN interfaceboth- Both WAN interfaces
- Protocol string
- The network protocol(s) this rule applies to. Valid values are:
tcp_udp- Both TCP and UDP (default)tcp- TCP onlyudp- UDP only
- Site string
- The name of the UniFi site where the port forwarding rule should be created. If not specified, the default site will be used.
- Src
Ip string - The source IP address or network in CIDR notation that is allowed to use this port forward. Use 'any' to allow all source IPs. Examples: '203.0.113.1' for a single IP, '203.0.113.0/24' for a network, or 'any' for all IPs.
- dst
Port String - The external port(s) that will be forwarded. Can be a single port (e.g., '80') or a port range (e.g., '8080:8090').
- enabled Boolean
- Specifies whether the port forwarding rule is enabled or not.
- fwd
Ip String - The internal IPv4 address of the device or service that will receive the forwarded traffic (e.g., '192.168.1.100').
- fwd
Port String - The internal port(s) that will receive the forwarded traffic. Can be a single port (e.g., '8080') or a port range (e.g., '8080:8090').
- log Boolean
- Enable logging of traffic matching this port forwarding rule. Useful for monitoring and troubleshooting.
- name String
- A friendly name for the port forwarding rule to help identify its purpose (e.g., 'Web Server' or 'Game Server').
- port
Forward StringInterface - The WAN interface to apply the port forwarding rule to. Valid values are:
wan- Primary WAN interfacewan2- Secondary WAN interfaceboth- Both WAN interfaces
- protocol String
- The network protocol(s) this rule applies to. Valid values are:
tcp_udp- Both TCP and UDP (default)tcp- TCP onlyudp- UDP only
- site String
- The name of the UniFi site where the port forwarding rule should be created. If not specified, the default site will be used.
- src
Ip String - The source IP address or network in CIDR notation that is allowed to use this port forward. Use 'any' to allow all source IPs. Examples: '203.0.113.1' for a single IP, '203.0.113.0/24' for a network, or 'any' for all IPs.
- dst
Port string - The external port(s) that will be forwarded. Can be a single port (e.g., '80') or a port range (e.g., '8080:8090').
- enabled boolean
- Specifies whether the port forwarding rule is enabled or not.
- fwd
Ip string - The internal IPv4 address of the device or service that will receive the forwarded traffic (e.g., '192.168.1.100').
- fwd
Port string - The internal port(s) that will receive the forwarded traffic. Can be a single port (e.g., '8080') or a port range (e.g., '8080:8090').
- log boolean
- Enable logging of traffic matching this port forwarding rule. Useful for monitoring and troubleshooting.
- name string
- A friendly name for the port forwarding rule to help identify its purpose (e.g., 'Web Server' or 'Game Server').
- port
Forward stringInterface - The WAN interface to apply the port forwarding rule to. Valid values are:
wan- Primary WAN interfacewan2- Secondary WAN interfaceboth- Both WAN interfaces
- protocol string
- The network protocol(s) this rule applies to. Valid values are:
tcp_udp- Both TCP and UDP (default)tcp- TCP onlyudp- UDP only
- site string
- The name of the UniFi site where the port forwarding rule should be created. If not specified, the default site will be used.
- src
Ip string - The source IP address or network in CIDR notation that is allowed to use this port forward. Use 'any' to allow all source IPs. Examples: '203.0.113.1' for a single IP, '203.0.113.0/24' for a network, or 'any' for all IPs.
- dst_
port str - The external port(s) that will be forwarded. Can be a single port (e.g., '80') or a port range (e.g., '8080:8090').
- enabled bool
- Specifies whether the port forwarding rule is enabled or not.
- fwd_
ip str - The internal IPv4 address of the device or service that will receive the forwarded traffic (e.g., '192.168.1.100').
- fwd_
port str - The internal port(s) that will receive the forwarded traffic. Can be a single port (e.g., '8080') or a port range (e.g., '8080:8090').
- log bool
- Enable logging of traffic matching this port forwarding rule. Useful for monitoring and troubleshooting.
- name str
- A friendly name for the port forwarding rule to help identify its purpose (e.g., 'Web Server' or 'Game Server').
- port_
forward_ strinterface - The WAN interface to apply the port forwarding rule to. Valid values are:
wan- Primary WAN interfacewan2- Secondary WAN interfaceboth- Both WAN interfaces
- protocol str
- The network protocol(s) this rule applies to. Valid values are:
tcp_udp- Both TCP and UDP (default)tcp- TCP onlyudp- UDP only
- site str
- The name of the UniFi site where the port forwarding rule should be created. If not specified, the default site will be used.
- src_
ip str - The source IP address or network in CIDR notation that is allowed to use this port forward. Use 'any' to allow all source IPs. Examples: '203.0.113.1' for a single IP, '203.0.113.0/24' for a network, or 'any' for all IPs.
- dst
Port String - The external port(s) that will be forwarded. Can be a single port (e.g., '80') or a port range (e.g., '8080:8090').
- enabled Boolean
- Specifies whether the port forwarding rule is enabled or not.
- fwd
Ip String - The internal IPv4 address of the device or service that will receive the forwarded traffic (e.g., '192.168.1.100').
- fwd
Port String - The internal port(s) that will receive the forwarded traffic. Can be a single port (e.g., '8080') or a port range (e.g., '8080:8090').
- log Boolean
- Enable logging of traffic matching this port forwarding rule. Useful for monitoring and troubleshooting.
- name String
- A friendly name for the port forwarding rule to help identify its purpose (e.g., 'Web Server' or 'Game Server').
- port
Forward StringInterface - The WAN interface to apply the port forwarding rule to. Valid values are:
wan- Primary WAN interfacewan2- Secondary WAN interfaceboth- Both WAN interfaces
- protocol String
- The network protocol(s) this rule applies to. Valid values are:
tcp_udp- Both TCP and UDP (default)tcp- TCP onlyudp- UDP only
- site String
- The name of the UniFi site where the port forwarding rule should be created. If not specified, the default site will be used.
- src
Ip String - The source IP address or network in CIDR notation that is allowed to use this port forward. Use 'any' to allow all source IPs. Examples: '203.0.113.1' for a single IP, '203.0.113.0/24' for a network, or 'any' for all IPs.
Outputs
All input properties are implicitly available as output properties. Additionally, the Forward resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Forward Resource
Get an existing Forward resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: ForwardState, opts?: CustomResourceOptions): Forward@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
dst_port: Optional[str] = None,
enabled: Optional[bool] = None,
fwd_ip: Optional[str] = None,
fwd_port: Optional[str] = None,
log: Optional[bool] = None,
name: Optional[str] = None,
port_forward_interface: Optional[str] = None,
protocol: Optional[str] = None,
site: Optional[str] = None,
src_ip: Optional[str] = None) -> Forwardfunc GetForward(ctx *Context, name string, id IDInput, state *ForwardState, opts ...ResourceOption) (*Forward, error)public static Forward Get(string name, Input<string> id, ForwardState? state, CustomResourceOptions? opts = null)public static Forward get(String name, Output<String> id, ForwardState state, CustomResourceOptions options)resources: _: type: unifi:port:Forward get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Dst
Port string - The external port(s) that will be forwarded. Can be a single port (e.g., '80') or a port range (e.g., '8080:8090').
- Enabled bool
- Specifies whether the port forwarding rule is enabled or not.
- Fwd
Ip string - The internal IPv4 address of the device or service that will receive the forwarded traffic (e.g., '192.168.1.100').
- Fwd
Port string - The internal port(s) that will receive the forwarded traffic. Can be a single port (e.g., '8080') or a port range (e.g., '8080:8090').
- Log bool
- Enable logging of traffic matching this port forwarding rule. Useful for monitoring and troubleshooting.
- Name string
- A friendly name for the port forwarding rule to help identify its purpose (e.g., 'Web Server' or 'Game Server').
- Port
Forward stringInterface - The WAN interface to apply the port forwarding rule to. Valid values are:
wan- Primary WAN interfacewan2- Secondary WAN interfaceboth- Both WAN interfaces
- Protocol string
- The network protocol(s) this rule applies to. Valid values are:
tcp_udp- Both TCP and UDP (default)tcp- TCP onlyudp- UDP only
- Site string
- The name of the UniFi site where the port forwarding rule should be created. If not specified, the default site will be used.
- Src
Ip string - The source IP address or network in CIDR notation that is allowed to use this port forward. Use 'any' to allow all source IPs. Examples: '203.0.113.1' for a single IP, '203.0.113.0/24' for a network, or 'any' for all IPs.
- Dst
Port string - The external port(s) that will be forwarded. Can be a single port (e.g., '80') or a port range (e.g., '8080:8090').
- Enabled bool
- Specifies whether the port forwarding rule is enabled or not.
- Fwd
Ip string - The internal IPv4 address of the device or service that will receive the forwarded traffic (e.g., '192.168.1.100').
- Fwd
Port string - The internal port(s) that will receive the forwarded traffic. Can be a single port (e.g., '8080') or a port range (e.g., '8080:8090').
- Log bool
- Enable logging of traffic matching this port forwarding rule. Useful for monitoring and troubleshooting.
- Name string
- A friendly name for the port forwarding rule to help identify its purpose (e.g., 'Web Server' or 'Game Server').
- Port
Forward stringInterface - The WAN interface to apply the port forwarding rule to. Valid values are:
wan- Primary WAN interfacewan2- Secondary WAN interfaceboth- Both WAN interfaces
- Protocol string
- The network protocol(s) this rule applies to. Valid values are:
tcp_udp- Both TCP and UDP (default)tcp- TCP onlyudp- UDP only
- Site string
- The name of the UniFi site where the port forwarding rule should be created. If not specified, the default site will be used.
- Src
Ip string - The source IP address or network in CIDR notation that is allowed to use this port forward. Use 'any' to allow all source IPs. Examples: '203.0.113.1' for a single IP, '203.0.113.0/24' for a network, or 'any' for all IPs.
- dst
Port String - The external port(s) that will be forwarded. Can be a single port (e.g., '80') or a port range (e.g., '8080:8090').
- enabled Boolean
- Specifies whether the port forwarding rule is enabled or not.
- fwd
Ip String - The internal IPv4 address of the device or service that will receive the forwarded traffic (e.g., '192.168.1.100').
- fwd
Port String - The internal port(s) that will receive the forwarded traffic. Can be a single port (e.g., '8080') or a port range (e.g., '8080:8090').
- log Boolean
- Enable logging of traffic matching this port forwarding rule. Useful for monitoring and troubleshooting.
- name String
- A friendly name for the port forwarding rule to help identify its purpose (e.g., 'Web Server' or 'Game Server').
- port
Forward StringInterface - The WAN interface to apply the port forwarding rule to. Valid values are:
wan- Primary WAN interfacewan2- Secondary WAN interfaceboth- Both WAN interfaces
- protocol String
- The network protocol(s) this rule applies to. Valid values are:
tcp_udp- Both TCP and UDP (default)tcp- TCP onlyudp- UDP only
- site String
- The name of the UniFi site where the port forwarding rule should be created. If not specified, the default site will be used.
- src
Ip String - The source IP address or network in CIDR notation that is allowed to use this port forward. Use 'any' to allow all source IPs. Examples: '203.0.113.1' for a single IP, '203.0.113.0/24' for a network, or 'any' for all IPs.
- dst
Port string - The external port(s) that will be forwarded. Can be a single port (e.g., '80') or a port range (e.g., '8080:8090').
- enabled boolean
- Specifies whether the port forwarding rule is enabled or not.
- fwd
Ip string - The internal IPv4 address of the device or service that will receive the forwarded traffic (e.g., '192.168.1.100').
- fwd
Port string - The internal port(s) that will receive the forwarded traffic. Can be a single port (e.g., '8080') or a port range (e.g., '8080:8090').
- log boolean
- Enable logging of traffic matching this port forwarding rule. Useful for monitoring and troubleshooting.
- name string
- A friendly name for the port forwarding rule to help identify its purpose (e.g., 'Web Server' or 'Game Server').
- port
Forward stringInterface - The WAN interface to apply the port forwarding rule to. Valid values are:
wan- Primary WAN interfacewan2- Secondary WAN interfaceboth- Both WAN interfaces
- protocol string
- The network protocol(s) this rule applies to. Valid values are:
tcp_udp- Both TCP and UDP (default)tcp- TCP onlyudp- UDP only
- site string
- The name of the UniFi site where the port forwarding rule should be created. If not specified, the default site will be used.
- src
Ip string - The source IP address or network in CIDR notation that is allowed to use this port forward. Use 'any' to allow all source IPs. Examples: '203.0.113.1' for a single IP, '203.0.113.0/24' for a network, or 'any' for all IPs.
- dst_
port str - The external port(s) that will be forwarded. Can be a single port (e.g., '80') or a port range (e.g., '8080:8090').
- enabled bool
- Specifies whether the port forwarding rule is enabled or not.
- fwd_
ip str - The internal IPv4 address of the device or service that will receive the forwarded traffic (e.g., '192.168.1.100').
- fwd_
port str - The internal port(s) that will receive the forwarded traffic. Can be a single port (e.g., '8080') or a port range (e.g., '8080:8090').
- log bool
- Enable logging of traffic matching this port forwarding rule. Useful for monitoring and troubleshooting.
- name str
- A friendly name for the port forwarding rule to help identify its purpose (e.g., 'Web Server' or 'Game Server').
- port_
forward_ strinterface - The WAN interface to apply the port forwarding rule to. Valid values are:
wan- Primary WAN interfacewan2- Secondary WAN interfaceboth- Both WAN interfaces
- protocol str
- The network protocol(s) this rule applies to. Valid values are:
tcp_udp- Both TCP and UDP (default)tcp- TCP onlyudp- UDP only
- site str
- The name of the UniFi site where the port forwarding rule should be created. If not specified, the default site will be used.
- src_
ip str - The source IP address or network in CIDR notation that is allowed to use this port forward. Use 'any' to allow all source IPs. Examples: '203.0.113.1' for a single IP, '203.0.113.0/24' for a network, or 'any' for all IPs.
- dst
Port String - The external port(s) that will be forwarded. Can be a single port (e.g., '80') or a port range (e.g., '8080:8090').
- enabled Boolean
- Specifies whether the port forwarding rule is enabled or not.
- fwd
Ip String - The internal IPv4 address of the device or service that will receive the forwarded traffic (e.g., '192.168.1.100').
- fwd
Port String - The internal port(s) that will receive the forwarded traffic. Can be a single port (e.g., '8080') or a port range (e.g., '8080:8090').
- log Boolean
- Enable logging of traffic matching this port forwarding rule. Useful for monitoring and troubleshooting.
- name String
- A friendly name for the port forwarding rule to help identify its purpose (e.g., 'Web Server' or 'Game Server').
- port
Forward StringInterface - The WAN interface to apply the port forwarding rule to. Valid values are:
wan- Primary WAN interfacewan2- Secondary WAN interfaceboth- Both WAN interfaces
- protocol String
- The network protocol(s) this rule applies to. Valid values are:
tcp_udp- Both TCP and UDP (default)tcp- TCP onlyudp- UDP only
- site String
- The name of the UniFi site where the port forwarding rule should be created. If not specified, the default site will be used.
- src
Ip String - The source IP address or network in CIDR notation that is allowed to use this port forward. Use 'any' to allow all source IPs. Examples: '203.0.113.1' for a single IP, '203.0.113.0/24' for a network, or 'any' for all IPs.
Package Details
- Repository
- unifi pulumiverse/pulumi-unifi
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
unifiTerraform Provider.
