1. Packages
  2. Openwrt Provider
  3. API Docs
  4. NetworkDevice
openwrt 0.0.20 published on Friday, Mar 7, 2025 by joneshf

openwrt.NetworkDevice

Explore with Pulumi AI

A physical or virtual “device” in OpenWrt jargon. Commonly referred to as an “interface” in other networking jargon.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as openwrt from "@pulumi/openwrt";

const brTesting = new openwrt.NetworkDevice("brTesting", {
    networkDeviceId: "br_testing",
    ports: [
        "eth0",
        "eth1",
        "eth2.20",
    ],
    type: "bridge",
});
Copy
import pulumi
import pulumi_openwrt as openwrt

br_testing = openwrt.NetworkDevice("brTesting",
    network_device_id="br_testing",
    ports=[
        "eth0",
        "eth1",
        "eth2.20",
    ],
    type="bridge")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/openwrt/openwrt"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := openwrt.NewNetworkDevice(ctx, "brTesting", &openwrt.NetworkDeviceArgs{
			NetworkDeviceId: pulumi.String("br_testing"),
			Ports: pulumi.StringArray{
				pulumi.String("eth0"),
				pulumi.String("eth1"),
				pulumi.String("eth2.20"),
			},
			Type: pulumi.String("bridge"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Openwrt = Pulumi.Openwrt;

return await Deployment.RunAsync(() => 
{
    var brTesting = new Openwrt.NetworkDevice("brTesting", new()
    {
        NetworkDeviceId = "br_testing",
        Ports = new[]
        {
            "eth0",
            "eth1",
            "eth2.20",
        },
        Type = "bridge",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openwrt.NetworkDevice;
import com.pulumi.openwrt.NetworkDeviceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var brTesting = new NetworkDevice("brTesting", NetworkDeviceArgs.builder()
            .networkDeviceId("br_testing")
            .ports(            
                "eth0",
                "eth1",
                "eth2.20")
            .type("bridge")
            .build());

    }
}
Copy
resources:
  brTesting:
    type: openwrt:NetworkDevice
    properties:
      networkDeviceId: br_testing
      ports:
        - eth0
        - eth1
        - eth2.20
      type: bridge
Copy

Create NetworkDevice Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new NetworkDevice(name: string, args: NetworkDeviceArgs, opts?: CustomResourceOptions);
@overload
def NetworkDevice(resource_name: str,
                  args: NetworkDeviceArgs,
                  opts: Optional[ResourceOptions] = None)

@overload
def NetworkDevice(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  network_device_id: Optional[str] = None,
                  type: Optional[str] = None,
                  bridge_empty: Optional[bool] = None,
                  dadtransmits: Optional[float] = None,
                  ipv6: Optional[bool] = None,
                  macaddr: Optional[str] = None,
                  mtu: Optional[float] = None,
                  mtu6: Optional[float] = None,
                  name: Optional[str] = None,
                  ports: Optional[Sequence[str]] = None,
                  txqueuelen: Optional[float] = None)
func NewNetworkDevice(ctx *Context, name string, args NetworkDeviceArgs, opts ...ResourceOption) (*NetworkDevice, error)
public NetworkDevice(string name, NetworkDeviceArgs args, CustomResourceOptions? opts = null)
public NetworkDevice(String name, NetworkDeviceArgs args)
public NetworkDevice(String name, NetworkDeviceArgs args, CustomResourceOptions options)
type: openwrt:NetworkDevice
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. NetworkDeviceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. NetworkDeviceArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. NetworkDeviceArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. NetworkDeviceArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. NetworkDeviceArgs
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 networkDeviceResource = new Openwrt.NetworkDevice("networkDeviceResource", new()
{
    NetworkDeviceId = "string",
    Type = "string",
    BridgeEmpty = false,
    Dadtransmits = 0,
    Ipv6 = false,
    Macaddr = "string",
    Mtu = 0,
    Mtu6 = 0,
    Name = "string",
    Ports = new[]
    {
        "string",
    },
    Txqueuelen = 0,
});
Copy
example, err := openwrt.NewNetworkDevice(ctx, "networkDeviceResource", &openwrt.NetworkDeviceArgs{
	NetworkDeviceId: pulumi.String("string"),
	Type:            pulumi.String("string"),
	BridgeEmpty:     pulumi.Bool(false),
	Dadtransmits:    pulumi.Float64(0),
	Ipv6:            pulumi.Bool(false),
	Macaddr:         pulumi.String("string"),
	Mtu:             pulumi.Float64(0),
	Mtu6:            pulumi.Float64(0),
	Name:            pulumi.String("string"),
	Ports: pulumi.StringArray{
		pulumi.String("string"),
	},
	Txqueuelen: pulumi.Float64(0),
})
Copy
var networkDeviceResource = new NetworkDevice("networkDeviceResource", NetworkDeviceArgs.builder()
    .networkDeviceId("string")
    .type("string")
    .bridgeEmpty(false)
    .dadtransmits(0)
    .ipv6(false)
    .macaddr("string")
    .mtu(0)
    .mtu6(0)
    .name("string")
    .ports("string")
    .txqueuelen(0)
    .build());
Copy
network_device_resource = openwrt.NetworkDevice("networkDeviceResource",
    network_device_id="string",
    type="string",
    bridge_empty=False,
    dadtransmits=0,
    ipv6=False,
    macaddr="string",
    mtu=0,
    mtu6=0,
    name="string",
    ports=["string"],
    txqueuelen=0)
Copy
const networkDeviceResource = new openwrt.NetworkDevice("networkDeviceResource", {
    networkDeviceId: "string",
    type: "string",
    bridgeEmpty: false,
    dadtransmits: 0,
    ipv6: false,
    macaddr: "string",
    mtu: 0,
    mtu6: 0,
    name: "string",
    ports: ["string"],
    txqueuelen: 0,
});
Copy
type: openwrt:NetworkDevice
properties:
    bridgeEmpty: false
    dadtransmits: 0
    ipv6: false
    macaddr: string
    mtu: 0
    mtu6: 0
    name: string
    networkDeviceId: string
    ports:
        - string
    txqueuelen: 0
    type: string
Copy

NetworkDevice 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 NetworkDevice resource accepts the following input properties:

NetworkDeviceId This property is required. string
Name of the section. This name is only used when interacting with UCI directly.
Type This property is required. string
The type of device. Currently, only "bridge" is supported.
BridgeEmpty bool
Bring up the bridge device even if no ports are attached
Dadtransmits double
Amount of Duplicate Address Detection probes to send
Ipv6 bool
Enable IPv6 for the device.
Macaddr string
MAC Address of the device.
Mtu double
Maximum Transmissible Unit.
Mtu6 double
Maximum Transmissible Unit for IPv6.
Name string
Name of the device. This name is referenced in other network configuration.
Ports List<string>
Specifies the wired ports to attach to this bridge.
Txqueuelen double
Transmission queue length.
NetworkDeviceId This property is required. string
Name of the section. This name is only used when interacting with UCI directly.
Type This property is required. string
The type of device. Currently, only "bridge" is supported.
BridgeEmpty bool
Bring up the bridge device even if no ports are attached
Dadtransmits float64
Amount of Duplicate Address Detection probes to send
Ipv6 bool
Enable IPv6 for the device.
Macaddr string
MAC Address of the device.
Mtu float64
Maximum Transmissible Unit.
Mtu6 float64
Maximum Transmissible Unit for IPv6.
Name string
Name of the device. This name is referenced in other network configuration.
Ports []string
Specifies the wired ports to attach to this bridge.
Txqueuelen float64
Transmission queue length.
networkDeviceId This property is required. String
Name of the section. This name is only used when interacting with UCI directly.
type This property is required. String
The type of device. Currently, only "bridge" is supported.
bridgeEmpty Boolean
Bring up the bridge device even if no ports are attached
dadtransmits Double
Amount of Duplicate Address Detection probes to send
ipv6 Boolean
Enable IPv6 for the device.
macaddr String
MAC Address of the device.
mtu Double
Maximum Transmissible Unit.
mtu6 Double
Maximum Transmissible Unit for IPv6.
name String
Name of the device. This name is referenced in other network configuration.
ports List<String>
Specifies the wired ports to attach to this bridge.
txqueuelen Double
Transmission queue length.
networkDeviceId This property is required. string
Name of the section. This name is only used when interacting with UCI directly.
type This property is required. string
The type of device. Currently, only "bridge" is supported.
bridgeEmpty boolean
Bring up the bridge device even if no ports are attached
dadtransmits number
Amount of Duplicate Address Detection probes to send
ipv6 boolean
Enable IPv6 for the device.
macaddr string
MAC Address of the device.
mtu number
Maximum Transmissible Unit.
mtu6 number
Maximum Transmissible Unit for IPv6.
name string
Name of the device. This name is referenced in other network configuration.
ports string[]
Specifies the wired ports to attach to this bridge.
txqueuelen number
Transmission queue length.
network_device_id This property is required. str
Name of the section. This name is only used when interacting with UCI directly.
type This property is required. str
The type of device. Currently, only "bridge" is supported.
bridge_empty bool
Bring up the bridge device even if no ports are attached
dadtransmits float
Amount of Duplicate Address Detection probes to send
ipv6 bool
Enable IPv6 for the device.
macaddr str
MAC Address of the device.
mtu float
Maximum Transmissible Unit.
mtu6 float
Maximum Transmissible Unit for IPv6.
name str
Name of the device. This name is referenced in other network configuration.
ports Sequence[str]
Specifies the wired ports to attach to this bridge.
txqueuelen float
Transmission queue length.
networkDeviceId This property is required. String
Name of the section. This name is only used when interacting with UCI directly.
type This property is required. String
The type of device. Currently, only "bridge" is supported.
bridgeEmpty Boolean
Bring up the bridge device even if no ports are attached
dadtransmits Number
Amount of Duplicate Address Detection probes to send
ipv6 Boolean
Enable IPv6 for the device.
macaddr String
MAC Address of the device.
mtu Number
Maximum Transmissible Unit.
mtu6 Number
Maximum Transmissible Unit for IPv6.
name String
Name of the device. This name is referenced in other network configuration.
ports List<String>
Specifies the wired ports to attach to this bridge.
txqueuelen Number
Transmission queue length.

Outputs

All input properties are implicitly available as output properties. Additionally, the NetworkDevice 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 NetworkDevice Resource

Get an existing NetworkDevice 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?: NetworkDeviceState, opts?: CustomResourceOptions): NetworkDevice
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        bridge_empty: Optional[bool] = None,
        dadtransmits: Optional[float] = None,
        ipv6: Optional[bool] = None,
        macaddr: Optional[str] = None,
        mtu: Optional[float] = None,
        mtu6: Optional[float] = None,
        name: Optional[str] = None,
        network_device_id: Optional[str] = None,
        ports: Optional[Sequence[str]] = None,
        txqueuelen: Optional[float] = None,
        type: Optional[str] = None) -> NetworkDevice
func GetNetworkDevice(ctx *Context, name string, id IDInput, state *NetworkDeviceState, opts ...ResourceOption) (*NetworkDevice, error)
public static NetworkDevice Get(string name, Input<string> id, NetworkDeviceState? state, CustomResourceOptions? opts = null)
public static NetworkDevice get(String name, Output<String> id, NetworkDeviceState state, CustomResourceOptions options)
resources:  _:    type: openwrt:NetworkDevice    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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.
The following state arguments are supported:
BridgeEmpty bool
Bring up the bridge device even if no ports are attached
Dadtransmits double
Amount of Duplicate Address Detection probes to send
Ipv6 bool
Enable IPv6 for the device.
Macaddr string
MAC Address of the device.
Mtu double
Maximum Transmissible Unit.
Mtu6 double
Maximum Transmissible Unit for IPv6.
Name string
Name of the device. This name is referenced in other network configuration.
NetworkDeviceId string
Name of the section. This name is only used when interacting with UCI directly.
Ports List<string>
Specifies the wired ports to attach to this bridge.
Txqueuelen double
Transmission queue length.
Type string
The type of device. Currently, only "bridge" is supported.
BridgeEmpty bool
Bring up the bridge device even if no ports are attached
Dadtransmits float64
Amount of Duplicate Address Detection probes to send
Ipv6 bool
Enable IPv6 for the device.
Macaddr string
MAC Address of the device.
Mtu float64
Maximum Transmissible Unit.
Mtu6 float64
Maximum Transmissible Unit for IPv6.
Name string
Name of the device. This name is referenced in other network configuration.
NetworkDeviceId string
Name of the section. This name is only used when interacting with UCI directly.
Ports []string
Specifies the wired ports to attach to this bridge.
Txqueuelen float64
Transmission queue length.
Type string
The type of device. Currently, only "bridge" is supported.
bridgeEmpty Boolean
Bring up the bridge device even if no ports are attached
dadtransmits Double
Amount of Duplicate Address Detection probes to send
ipv6 Boolean
Enable IPv6 for the device.
macaddr String
MAC Address of the device.
mtu Double
Maximum Transmissible Unit.
mtu6 Double
Maximum Transmissible Unit for IPv6.
name String
Name of the device. This name is referenced in other network configuration.
networkDeviceId String
Name of the section. This name is only used when interacting with UCI directly.
ports List<String>
Specifies the wired ports to attach to this bridge.
txqueuelen Double
Transmission queue length.
type String
The type of device. Currently, only "bridge" is supported.
bridgeEmpty boolean
Bring up the bridge device even if no ports are attached
dadtransmits number
Amount of Duplicate Address Detection probes to send
ipv6 boolean
Enable IPv6 for the device.
macaddr string
MAC Address of the device.
mtu number
Maximum Transmissible Unit.
mtu6 number
Maximum Transmissible Unit for IPv6.
name string
Name of the device. This name is referenced in other network configuration.
networkDeviceId string
Name of the section. This name is only used when interacting with UCI directly.
ports string[]
Specifies the wired ports to attach to this bridge.
txqueuelen number
Transmission queue length.
type string
The type of device. Currently, only "bridge" is supported.
bridge_empty bool
Bring up the bridge device even if no ports are attached
dadtransmits float
Amount of Duplicate Address Detection probes to send
ipv6 bool
Enable IPv6 for the device.
macaddr str
MAC Address of the device.
mtu float
Maximum Transmissible Unit.
mtu6 float
Maximum Transmissible Unit for IPv6.
name str
Name of the device. This name is referenced in other network configuration.
network_device_id str
Name of the section. This name is only used when interacting with UCI directly.
ports Sequence[str]
Specifies the wired ports to attach to this bridge.
txqueuelen float
Transmission queue length.
type str
The type of device. Currently, only "bridge" is supported.
bridgeEmpty Boolean
Bring up the bridge device even if no ports are attached
dadtransmits Number
Amount of Duplicate Address Detection probes to send
ipv6 Boolean
Enable IPv6 for the device.
macaddr String
MAC Address of the device.
mtu Number
Maximum Transmissible Unit.
mtu6 Number
Maximum Transmissible Unit for IPv6.
name String
Name of the device. This name is referenced in other network configuration.
networkDeviceId String
Name of the section. This name is only used when interacting with UCI directly.
ports List<String>
Specifies the wired ports to attach to this bridge.
txqueuelen Number
Transmission queue length.
type String
The type of device. Currently, only "bridge" is supported.

Import

Find the Terraform id and UCI name from LuCI’s JSON-RPC API.

One way to find this information is with curl and jq:

curl \

--data '{"id": 0, "method": "foreach", "params": ["network", "device"]}' \

http://192.168.1.1/cgi-bin/luci/rpc/uci?auth=$AUTH_TOKEN \

| jq '.result | map({terraformId: .[".name"], uciName: .name})'

This command will output something like:

[

{

"terraformId": "cfg030f15",

"uciName": "foo"

},

{

"terraformId": "cfg040f15",

"uciName": "bar"

}

]

We’d then use the information to import the appropriate resource:

$ pulumi import openwrt:index/networkDevice:NetworkDevice foo cfg030f15
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
openwrt joneshf/terraform-provider-openwrt
License
Notes
This Pulumi package is based on the openwrt Terraform Provider.