unifi.Device
Explore with Pulumi AI
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as unifi from "@pulumi/unifi";
import * as unifi from "@pulumiverse/unifi";
const disabled = unifi.port.getProfile({
    name: "Disabled",
});
const poe = new unifi.port.Profile("poe", {
    name: "poe",
    forward: "customize",
    nativeNetworkconfId: nativeNetworkId,
    taggedNetworkconfIds: [someVlanNetworkId],
    poeMode: "auto",
});
const us24Poe = new unifi.Device("us_24_poe", {
    mac: "01:23:45:67:89:AB",
    name: "Switch with POE",
    portOverrides: [
        {
            number: 1,
            name: "port w/ poe",
            portProfileId: poe.id,
        },
        {
            number: 2,
            name: "disabled",
            portProfileId: disabled.then(disabled => disabled.id),
        },
        {
            number: 11,
            opMode: "aggregate",
            aggregateNumPorts: 2,
        },
    ],
});
import pulumi
import pulumi_unifi as unifi
import pulumiverse_unifi as unifi
disabled = unifi.port.get_profile(name="Disabled")
poe = unifi.port.Profile("poe",
    name="poe",
    forward="customize",
    native_networkconf_id=native_network_id,
    tagged_networkconf_ids=[some_vlan_network_id],
    poe_mode="auto")
us24_poe = unifi.Device("us_24_poe",
    mac="01:23:45:67:89:AB",
    name="Switch with POE",
    port_overrides=[
        {
            "number": 1,
            "name": "port w/ poe",
            "port_profile_id": poe.id,
        },
        {
            "number": 2,
            "name": "disabled",
            "port_profile_id": disabled.id,
        },
        {
            "number": 11,
            "op_mode": "aggregate",
            "aggregate_num_ports": 2,
        },
    ])
package main
import (
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumiverse/pulumi-unifi/sdk/go/unifi"
	"github.com/pulumiverse/pulumi-unifi/sdk/go/unifi/port"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		disabled, err := port.LookupProfile(ctx, &port.LookupProfileArgs{
			Name: pulumi.StringRef("Disabled"),
		}, nil)
		if err != nil {
			return err
		}
		poe, err := port.NewProfile(ctx, "poe", &port.ProfileArgs{
			Name:                pulumi.String("poe"),
			Forward:             pulumi.String("customize"),
			NativeNetworkconfId: pulumi.Any(nativeNetworkId),
			TaggedNetworkconfIds: pulumi.StringArray{
				someVlanNetworkId,
			},
			PoeMode: pulumi.String("auto"),
		})
		if err != nil {
			return err
		}
		_, err = unifi.NewDevice(ctx, "us_24_poe", &unifi.DeviceArgs{
			Mac:  pulumi.String("01:23:45:67:89:AB"),
			Name: pulumi.String("Switch with POE"),
			PortOverrides: unifi.DevicePortOverrideArray{
				&unifi.DevicePortOverrideArgs{
					Number:        pulumi.Int(1),
					Name:          pulumi.String("port w/ poe"),
					PortProfileId: poe.ID(),
				},
				&unifi.DevicePortOverrideArgs{
					Number:        pulumi.Int(2),
					Name:          pulumi.String("disabled"),
					PortProfileId: pulumi.String(disabled.Id),
				},
				&unifi.DevicePortOverrideArgs{
					Number:            pulumi.Int(11),
					OpMode:            pulumi.String("aggregate"),
					AggregateNumPorts: pulumi.Int(2),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Unifi = Pulumi.Unifi;
using Unifi = Pulumiverse.Unifi;
return await Deployment.RunAsync(() => 
{
    var disabled = Unifi.Port.GetProfile.Invoke(new()
    {
        Name = "Disabled",
    });
    var poe = new Unifi.Port.Profile("poe", new()
    {
        Name = "poe",
        Forward = "customize",
        NativeNetworkconfId = nativeNetworkId,
        TaggedNetworkconfIds = new[]
        {
            someVlanNetworkId,
        },
        PoeMode = "auto",
    });
    var us24Poe = new Unifi.Device("us_24_poe", new()
    {
        Mac = "01:23:45:67:89:AB",
        Name = "Switch with POE",
        PortOverrides = new[]
        {
            new Unifi.Inputs.DevicePortOverrideArgs
            {
                Number = 1,
                Name = "port w/ poe",
                PortProfileId = poe.Id,
            },
            new Unifi.Inputs.DevicePortOverrideArgs
            {
                Number = 2,
                Name = "disabled",
                PortProfileId = disabled.Apply(getProfileResult => getProfileResult.Id),
            },
            new Unifi.Inputs.DevicePortOverrideArgs
            {
                Number = 11,
                OpMode = "aggregate",
                AggregateNumPorts = 2,
            },
        },
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.unifi.port.PortFunctions;
import com.pulumi.unifi.port.inputs.GetProfileArgs;
import com.pulumi.unifi.port.Profile;
import com.pulumi.unifi.port.ProfileArgs;
import com.pulumi.unifi.Device;
import com.pulumi.unifi.DeviceArgs;
import com.pulumi.unifi.inputs.DevicePortOverrideArgs;
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) {
        final var disabled = PortFunctions.getProfile(GetProfileArgs.builder()
            .name("Disabled")
            .build());
        var poe = new Profile("poe", ProfileArgs.builder()
            .name("poe")
            .forward("customize")
            .nativeNetworkconfId(nativeNetworkId)
            .taggedNetworkconfIds(someVlanNetworkId)
            .poeMode("auto")
            .build());
        var us24Poe = new Device("us24Poe", DeviceArgs.builder()
            .mac("01:23:45:67:89:AB")
            .name("Switch with POE")
            .portOverrides(            
                DevicePortOverrideArgs.builder()
                    .number(1)
                    .name("port w/ poe")
                    .portProfileId(poe.id())
                    .build(),
                DevicePortOverrideArgs.builder()
                    .number(2)
                    .name("disabled")
                    .portProfileId(disabled.applyValue(getProfileResult -> getProfileResult.id()))
                    .build(),
                DevicePortOverrideArgs.builder()
                    .number(11)
                    .opMode("aggregate")
                    .aggregateNumPorts(2)
                    .build())
            .build());
    }
}
resources:
  poe:
    type: unifi:port:Profile
    properties:
      name: poe
      forward: customize
      nativeNetworkconfId: ${nativeNetworkId}
      taggedNetworkconfIds:
        - ${someVlanNetworkId}
      poeMode: auto
  us24Poe:
    type: unifi:Device
    name: us_24_poe
    properties:
      mac: 01:23:45:67:89:AB
      name: Switch with POE
      portOverrides:
        - number: 1
          name: port w/ poe
          portProfileId: ${poe.id}
        - number: 2
          name: disabled
          portProfileId: ${disabled.id}
        - number: 11
          opMode: aggregate
          aggregateNumPorts: 2
variables:
  disabled:
    fn::invoke:
      Function: unifi:port:getProfile
      Arguments:
        name: Disabled
Create Device Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Device(name: string, args?: DeviceArgs, opts?: CustomResourceOptions);@overload
def Device(resource_name: str,
           args: Optional[DeviceArgs] = None,
           opts: Optional[ResourceOptions] = None)
@overload
def Device(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           allow_adoption: Optional[bool] = None,
           forget_on_destroy: Optional[bool] = None,
           mac: Optional[str] = None,
           name: Optional[str] = None,
           port_overrides: Optional[Sequence[DevicePortOverrideArgs]] = None,
           site: Optional[str] = None)func NewDevice(ctx *Context, name string, args *DeviceArgs, opts ...ResourceOption) (*Device, error)public Device(string name, DeviceArgs? args = null, CustomResourceOptions? opts = null)
public Device(String name, DeviceArgs args)
public Device(String name, DeviceArgs args, CustomResourceOptions options)
type: unifi:Device
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 DeviceArgs
- 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 DeviceArgs
- 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 DeviceArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args DeviceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args DeviceArgs
- 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 deviceResource = new Unifi.Device("deviceResource", new()
{
    AllowAdoption = false,
    ForgetOnDestroy = false,
    Mac = "string",
    Name = "string",
    PortOverrides = new[]
    {
        new Unifi.Inputs.DevicePortOverrideArgs
        {
            Number = 0,
            AggregateNumPorts = 0,
            Name = "string",
            OpMode = "string",
            PortProfileId = "string",
        },
    },
    Site = "string",
});
example, err := unifi.NewDevice(ctx, "deviceResource", &unifi.DeviceArgs{
	AllowAdoption:   pulumi.Bool(false),
	ForgetOnDestroy: pulumi.Bool(false),
	Mac:             pulumi.String("string"),
	Name:            pulumi.String("string"),
	PortOverrides: unifi.DevicePortOverrideArray{
		&unifi.DevicePortOverrideArgs{
			Number:            pulumi.Int(0),
			AggregateNumPorts: pulumi.Int(0),
			Name:              pulumi.String("string"),
			OpMode:            pulumi.String("string"),
			PortProfileId:     pulumi.String("string"),
		},
	},
	Site: pulumi.String("string"),
})
var deviceResource = new Device("deviceResource", DeviceArgs.builder()
    .allowAdoption(false)
    .forgetOnDestroy(false)
    .mac("string")
    .name("string")
    .portOverrides(DevicePortOverrideArgs.builder()
        .number(0)
        .aggregateNumPorts(0)
        .name("string")
        .opMode("string")
        .portProfileId("string")
        .build())
    .site("string")
    .build());
device_resource = unifi.Device("deviceResource",
    allow_adoption=False,
    forget_on_destroy=False,
    mac="string",
    name="string",
    port_overrides=[{
        "number": 0,
        "aggregate_num_ports": 0,
        "name": "string",
        "op_mode": "string",
        "port_profile_id": "string",
    }],
    site="string")
const deviceResource = new unifi.Device("deviceResource", {
    allowAdoption: false,
    forgetOnDestroy: false,
    mac: "string",
    name: "string",
    portOverrides: [{
        number: 0,
        aggregateNumPorts: 0,
        name: "string",
        opMode: "string",
        portProfileId: "string",
    }],
    site: "string",
});
type: unifi:Device
properties:
    allowAdoption: false
    forgetOnDestroy: false
    mac: string
    name: string
    portOverrides:
        - aggregateNumPorts: 0
          name: string
          number: 0
          opMode: string
          portProfileId: string
    site: string
Device 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 Device resource accepts the following input properties:
- AllowAdoption bool
- Specifies whether this resource should tell the controller to adopt the device on create. Defaults to true.
- ForgetOn boolDestroy 
- Specifies whether this resource should tell the controller to forget the device on destroy. Defaults to true.
- Mac string
- The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).
- Name string
- The name of the device.
- PortOverrides List<Pulumiverse.Unifi. Inputs. Device Port Override> 
- Settings overrides for specific switch ports.
- Site string
- The name of the site to associate the device with.
- AllowAdoption bool
- Specifies whether this resource should tell the controller to adopt the device on create. Defaults to true.
- ForgetOn boolDestroy 
- Specifies whether this resource should tell the controller to forget the device on destroy. Defaults to true.
- Mac string
- The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).
- Name string
- The name of the device.
- PortOverrides []DevicePort Override Args 
- Settings overrides for specific switch ports.
- Site string
- The name of the site to associate the device with.
- allowAdoption Boolean
- Specifies whether this resource should tell the controller to adopt the device on create. Defaults to true.
- forgetOn BooleanDestroy 
- Specifies whether this resource should tell the controller to forget the device on destroy. Defaults to true.
- mac String
- The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).
- name String
- The name of the device.
- portOverrides List<DevicePort Override> 
- Settings overrides for specific switch ports.
- site String
- The name of the site to associate the device with.
- allowAdoption boolean
- Specifies whether this resource should tell the controller to adopt the device on create. Defaults to true.
- forgetOn booleanDestroy 
- Specifies whether this resource should tell the controller to forget the device on destroy. Defaults to true.
- mac string
- The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).
- name string
- The name of the device.
- portOverrides DevicePort Override[] 
- Settings overrides for specific switch ports.
- site string
- The name of the site to associate the device with.
- allow_adoption bool
- Specifies whether this resource should tell the controller to adopt the device on create. Defaults to true.
- forget_on_ booldestroy 
- Specifies whether this resource should tell the controller to forget the device on destroy. Defaults to true.
- mac str
- The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).
- name str
- The name of the device.
- port_overrides Sequence[DevicePort Override Args] 
- Settings overrides for specific switch ports.
- site str
- The name of the site to associate the device with.
- allowAdoption Boolean
- Specifies whether this resource should tell the controller to adopt the device on create. Defaults to true.
- forgetOn BooleanDestroy 
- Specifies whether this resource should tell the controller to forget the device on destroy. Defaults to true.
- mac String
- The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).
- name String
- The name of the device.
- portOverrides List<Property Map>
- Settings overrides for specific switch ports.
- site String
- The name of the site to associate the device with.
Outputs
All input properties are implicitly available as output properties. Additionally, the Device resource produces the following output properties:
Look up Existing Device Resource
Get an existing Device 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?: DeviceState, opts?: CustomResourceOptions): Device@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        allow_adoption: Optional[bool] = None,
        disabled: Optional[bool] = None,
        forget_on_destroy: Optional[bool] = None,
        mac: Optional[str] = None,
        name: Optional[str] = None,
        port_overrides: Optional[Sequence[DevicePortOverrideArgs]] = None,
        site: Optional[str] = None) -> Devicefunc GetDevice(ctx *Context, name string, id IDInput, state *DeviceState, opts ...ResourceOption) (*Device, error)public static Device Get(string name, Input<string> id, DeviceState? state, CustomResourceOptions? opts = null)public static Device get(String name, Output<String> id, DeviceState state, CustomResourceOptions options)resources:  _:    type: unifi:Device    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.
- AllowAdoption bool
- Specifies whether this resource should tell the controller to adopt the device on create. Defaults to true.
- Disabled bool
- Specifies whether this device should be disabled.
- ForgetOn boolDestroy 
- Specifies whether this resource should tell the controller to forget the device on destroy. Defaults to true.
- Mac string
- The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).
- Name string
- The name of the device.
- PortOverrides List<Pulumiverse.Unifi. Inputs. Device Port Override> 
- Settings overrides for specific switch ports.
- Site string
- The name of the site to associate the device with.
- AllowAdoption bool
- Specifies whether this resource should tell the controller to adopt the device on create. Defaults to true.
- Disabled bool
- Specifies whether this device should be disabled.
- ForgetOn boolDestroy 
- Specifies whether this resource should tell the controller to forget the device on destroy. Defaults to true.
- Mac string
- The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).
- Name string
- The name of the device.
- PortOverrides []DevicePort Override Args 
- Settings overrides for specific switch ports.
- Site string
- The name of the site to associate the device with.
- allowAdoption Boolean
- Specifies whether this resource should tell the controller to adopt the device on create. Defaults to true.
- disabled Boolean
- Specifies whether this device should be disabled.
- forgetOn BooleanDestroy 
- Specifies whether this resource should tell the controller to forget the device on destroy. Defaults to true.
- mac String
- The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).
- name String
- The name of the device.
- portOverrides List<DevicePort Override> 
- Settings overrides for specific switch ports.
- site String
- The name of the site to associate the device with.
- allowAdoption boolean
- Specifies whether this resource should tell the controller to adopt the device on create. Defaults to true.
- disabled boolean
- Specifies whether this device should be disabled.
- forgetOn booleanDestroy 
- Specifies whether this resource should tell the controller to forget the device on destroy. Defaults to true.
- mac string
- The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).
- name string
- The name of the device.
- portOverrides DevicePort Override[] 
- Settings overrides for specific switch ports.
- site string
- The name of the site to associate the device with.
- allow_adoption bool
- Specifies whether this resource should tell the controller to adopt the device on create. Defaults to true.
- disabled bool
- Specifies whether this device should be disabled.
- forget_on_ booldestroy 
- Specifies whether this resource should tell the controller to forget the device on destroy. Defaults to true.
- mac str
- The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).
- name str
- The name of the device.
- port_overrides Sequence[DevicePort Override Args] 
- Settings overrides for specific switch ports.
- site str
- The name of the site to associate the device with.
- allowAdoption Boolean
- Specifies whether this resource should tell the controller to adopt the device on create. Defaults to true.
- disabled Boolean
- Specifies whether this device should be disabled.
- forgetOn BooleanDestroy 
- Specifies whether this resource should tell the controller to forget the device on destroy. Defaults to true.
- mac String
- The MAC address of the device. This can be specified so that the provider can take control of a device (since devices are created through adoption).
- name String
- The name of the device.
- portOverrides List<Property Map>
- Settings overrides for specific switch ports.
- site String
- The name of the site to associate the device with.
Supporting Types
DevicePortOverride, DevicePortOverrideArgs      
- Number int
- Switch port number.
- AggregateNum intPorts 
- Number of ports in the aggregate.
- Name string
- Human-readable name of the port.
- OpMode string
- Operating mode of the port, valid values are switch,mirror, andaggregate. Defaults toswitch.
- PortProfile stringId 
- ID of the Port Profile used on this port.
- Number int
- Switch port number.
- AggregateNum intPorts 
- Number of ports in the aggregate.
- Name string
- Human-readable name of the port.
- OpMode string
- Operating mode of the port, valid values are switch,mirror, andaggregate. Defaults toswitch.
- PortProfile stringId 
- ID of the Port Profile used on this port.
- number Integer
- Switch port number.
- aggregateNum IntegerPorts 
- Number of ports in the aggregate.
- name String
- Human-readable name of the port.
- opMode String
- Operating mode of the port, valid values are switch,mirror, andaggregate. Defaults toswitch.
- portProfile StringId 
- ID of the Port Profile used on this port.
- number number
- Switch port number.
- aggregateNum numberPorts 
- Number of ports in the aggregate.
- name string
- Human-readable name of the port.
- opMode string
- Operating mode of the port, valid values are switch,mirror, andaggregate. Defaults toswitch.
- portProfile stringId 
- ID of the Port Profile used on this port.
- number int
- Switch port number.
- aggregate_num_ intports 
- Number of ports in the aggregate.
- name str
- Human-readable name of the port.
- op_mode str
- Operating mode of the port, valid values are switch,mirror, andaggregate. Defaults toswitch.
- port_profile_ strid 
- ID of the Port Profile used on this port.
- number Number
- Switch port number.
- aggregateNum NumberPorts 
- Number of ports in the aggregate.
- name String
- Human-readable name of the port.
- opMode String
- Operating mode of the port, valid values are switch,mirror, andaggregate. Defaults toswitch.
- portProfile StringId 
- ID of the Port Profile used on this port.
Package Details
- Repository
- unifi pulumiverse/pulumi-unifi
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the unifiTerraform Provider.