1. Packages
  2. Netbox Provider
  3. API Docs
  4. VirtualMachine
netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger

netbox.VirtualMachine

Explore with Pulumi AI

netbox logo
netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger

    From the official documentation:

    A virtual machine is a virtualized compute instance. These behave in NetBox very similarly to device objects, but without any physical attributes. For example, a VM may have interfaces assigned to it with IP addresses and VLANs, however its interfaces cannot be connected via cables (because they are virtual). Each VM may also define its compute, memory, and storage resources as well.

    Create VirtualMachine Resource

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

    Constructor syntax

    new VirtualMachine(name: string, args?: VirtualMachineArgs, opts?: CustomResourceOptions);
    @overload
    def VirtualMachine(resource_name: str,
                       args: Optional[VirtualMachineArgs] = None,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def VirtualMachine(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       cluster_id: Optional[float] = None,
                       comments: Optional[str] = None,
                       custom_fields: Optional[Mapping[str, str]] = None,
                       description: Optional[str] = None,
                       device_id: Optional[float] = None,
                       disk_size_mb: Optional[float] = None,
                       local_context_data: Optional[str] = None,
                       memory_mb: Optional[float] = None,
                       name: Optional[str] = None,
                       platform_id: Optional[float] = None,
                       role_id: Optional[float] = None,
                       site_id: Optional[float] = None,
                       status: Optional[str] = None,
                       tags: Optional[Sequence[str]] = None,
                       tenant_id: Optional[float] = None,
                       vcpus: Optional[float] = None,
                       virtual_machine_id: Optional[str] = None)
    func NewVirtualMachine(ctx *Context, name string, args *VirtualMachineArgs, opts ...ResourceOption) (*VirtualMachine, error)
    public VirtualMachine(string name, VirtualMachineArgs? args = null, CustomResourceOptions? opts = null)
    public VirtualMachine(String name, VirtualMachineArgs args)
    public VirtualMachine(String name, VirtualMachineArgs args, CustomResourceOptions options)
    
    type: netbox:VirtualMachine
    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 VirtualMachineArgs
    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 VirtualMachineArgs
    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 VirtualMachineArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VirtualMachineArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VirtualMachineArgs
    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 virtualMachineResource = new Netbox.VirtualMachine("virtualMachineResource", new()
    {
        ClusterId = 0,
        Comments = "string",
        CustomFields = 
        {
            { "string", "string" },
        },
        Description = "string",
        DeviceId = 0,
        DiskSizeMb = 0,
        LocalContextData = "string",
        MemoryMb = 0,
        Name = "string",
        PlatformId = 0,
        RoleId = 0,
        SiteId = 0,
        Status = "string",
        Tags = new[]
        {
            "string",
        },
        TenantId = 0,
        Vcpus = 0,
        VirtualMachineId = "string",
    });
    
    example, err := netbox.NewVirtualMachine(ctx, "virtualMachineResource", &netbox.VirtualMachineArgs{
    	ClusterId: pulumi.Float64(0),
    	Comments:  pulumi.String("string"),
    	CustomFields: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Description:      pulumi.String("string"),
    	DeviceId:         pulumi.Float64(0),
    	DiskSizeMb:       pulumi.Float64(0),
    	LocalContextData: pulumi.String("string"),
    	MemoryMb:         pulumi.Float64(0),
    	Name:             pulumi.String("string"),
    	PlatformId:       pulumi.Float64(0),
    	RoleId:           pulumi.Float64(0),
    	SiteId:           pulumi.Float64(0),
    	Status:           pulumi.String("string"),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	TenantId:         pulumi.Float64(0),
    	Vcpus:            pulumi.Float64(0),
    	VirtualMachineId: pulumi.String("string"),
    })
    
    var virtualMachineResource = new VirtualMachine("virtualMachineResource", VirtualMachineArgs.builder()
        .clusterId(0)
        .comments("string")
        .customFields(Map.of("string", "string"))
        .description("string")
        .deviceId(0)
        .diskSizeMb(0)
        .localContextData("string")
        .memoryMb(0)
        .name("string")
        .platformId(0)
        .roleId(0)
        .siteId(0)
        .status("string")
        .tags("string")
        .tenantId(0)
        .vcpus(0)
        .virtualMachineId("string")
        .build());
    
    virtual_machine_resource = netbox.VirtualMachine("virtualMachineResource",
        cluster_id=0,
        comments="string",
        custom_fields={
            "string": "string",
        },
        description="string",
        device_id=0,
        disk_size_mb=0,
        local_context_data="string",
        memory_mb=0,
        name="string",
        platform_id=0,
        role_id=0,
        site_id=0,
        status="string",
        tags=["string"],
        tenant_id=0,
        vcpus=0,
        virtual_machine_id="string")
    
    const virtualMachineResource = new netbox.VirtualMachine("virtualMachineResource", {
        clusterId: 0,
        comments: "string",
        customFields: {
            string: "string",
        },
        description: "string",
        deviceId: 0,
        diskSizeMb: 0,
        localContextData: "string",
        memoryMb: 0,
        name: "string",
        platformId: 0,
        roleId: 0,
        siteId: 0,
        status: "string",
        tags: ["string"],
        tenantId: 0,
        vcpus: 0,
        virtualMachineId: "string",
    });
    
    type: netbox:VirtualMachine
    properties:
        clusterId: 0
        comments: string
        customFields:
            string: string
        description: string
        deviceId: 0
        diskSizeMb: 0
        localContextData: string
        memoryMb: 0
        name: string
        platformId: 0
        roleId: 0
        siteId: 0
        status: string
        tags:
            - string
        tenantId: 0
        vcpus: 0
        virtualMachineId: string
    

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

    ClusterId double
    At least one of site_id or cluster_id must be given.
    Comments string
    CustomFields Dictionary<string, string>
    Description string
    DeviceId double
    DiskSizeMb double
    LocalContextData string
    This is best managed through the use of jsonencode and a map of settings.
    MemoryMb double
    Name string
    PlatformId double
    RoleId double
    SiteId double
    At least one of site_id or cluster_id must be given.
    Status string
    Valid values are offline, active, planned, staged, failed and decommissioning. Defaults to active.
    Tags List<string>
    TenantId double
    Vcpus double
    VirtualMachineId string
    The ID of this resource.
    ClusterId float64
    At least one of site_id or cluster_id must be given.
    Comments string
    CustomFields map[string]string
    Description string
    DeviceId float64
    DiskSizeMb float64
    LocalContextData string
    This is best managed through the use of jsonencode and a map of settings.
    MemoryMb float64
    Name string
    PlatformId float64
    RoleId float64
    SiteId float64
    At least one of site_id or cluster_id must be given.
    Status string
    Valid values are offline, active, planned, staged, failed and decommissioning. Defaults to active.
    Tags []string
    TenantId float64
    Vcpus float64
    VirtualMachineId string
    The ID of this resource.
    clusterId Double
    At least one of site_id or cluster_id must be given.
    comments String
    customFields Map<String,String>
    description String
    deviceId Double
    diskSizeMb Double
    localContextData String
    This is best managed through the use of jsonencode and a map of settings.
    memoryMb Double
    name String
    platformId Double
    roleId Double
    siteId Double
    At least one of site_id or cluster_id must be given.
    status String
    Valid values are offline, active, planned, staged, failed and decommissioning. Defaults to active.
    tags List<String>
    tenantId Double
    vcpus Double
    virtualMachineId String
    The ID of this resource.
    clusterId number
    At least one of site_id or cluster_id must be given.
    comments string
    customFields {[key: string]: string}
    description string
    deviceId number
    diskSizeMb number
    localContextData string
    This is best managed through the use of jsonencode and a map of settings.
    memoryMb number
    name string
    platformId number
    roleId number
    siteId number
    At least one of site_id or cluster_id must be given.
    status string
    Valid values are offline, active, planned, staged, failed and decommissioning. Defaults to active.
    tags string[]
    tenantId number
    vcpus number
    virtualMachineId string
    The ID of this resource.
    cluster_id float
    At least one of site_id or cluster_id must be given.
    comments str
    custom_fields Mapping[str, str]
    description str
    device_id float
    disk_size_mb float
    local_context_data str
    This is best managed through the use of jsonencode and a map of settings.
    memory_mb float
    name str
    platform_id float
    role_id float
    site_id float
    At least one of site_id or cluster_id must be given.
    status str
    Valid values are offline, active, planned, staged, failed and decommissioning. Defaults to active.
    tags Sequence[str]
    tenant_id float
    vcpus float
    virtual_machine_id str
    The ID of this resource.
    clusterId Number
    At least one of site_id or cluster_id must be given.
    comments String
    customFields Map<String>
    description String
    deviceId Number
    diskSizeMb Number
    localContextData String
    This is best managed through the use of jsonencode and a map of settings.
    memoryMb Number
    name String
    platformId Number
    roleId Number
    siteId Number
    At least one of site_id or cluster_id must be given.
    status String
    Valid values are offline, active, planned, staged, failed and decommissioning. Defaults to active.
    tags List<String>
    tenantId Number
    vcpus Number
    virtualMachineId String
    The ID of this resource.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the VirtualMachine resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    PrimaryIpv4 double
    PrimaryIpv6 double
    Id string
    The provider-assigned unique ID for this managed resource.
    PrimaryIpv4 float64
    PrimaryIpv6 float64
    id String
    The provider-assigned unique ID for this managed resource.
    primaryIpv4 Double
    primaryIpv6 Double
    id string
    The provider-assigned unique ID for this managed resource.
    primaryIpv4 number
    primaryIpv6 number
    id str
    The provider-assigned unique ID for this managed resource.
    primary_ipv4 float
    primary_ipv6 float
    id String
    The provider-assigned unique ID for this managed resource.
    primaryIpv4 Number
    primaryIpv6 Number

    Look up Existing VirtualMachine Resource

    Get an existing VirtualMachine 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?: VirtualMachineState, opts?: CustomResourceOptions): VirtualMachine
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cluster_id: Optional[float] = None,
            comments: Optional[str] = None,
            custom_fields: Optional[Mapping[str, str]] = None,
            description: Optional[str] = None,
            device_id: Optional[float] = None,
            disk_size_mb: Optional[float] = None,
            local_context_data: Optional[str] = None,
            memory_mb: Optional[float] = None,
            name: Optional[str] = None,
            platform_id: Optional[float] = None,
            primary_ipv4: Optional[float] = None,
            primary_ipv6: Optional[float] = None,
            role_id: Optional[float] = None,
            site_id: Optional[float] = None,
            status: Optional[str] = None,
            tags: Optional[Sequence[str]] = None,
            tenant_id: Optional[float] = None,
            vcpus: Optional[float] = None,
            virtual_machine_id: Optional[str] = None) -> VirtualMachine
    func GetVirtualMachine(ctx *Context, name string, id IDInput, state *VirtualMachineState, opts ...ResourceOption) (*VirtualMachine, error)
    public static VirtualMachine Get(string name, Input<string> id, VirtualMachineState? state, CustomResourceOptions? opts = null)
    public static VirtualMachine get(String name, Output<String> id, VirtualMachineState state, CustomResourceOptions options)
    resources:  _:    type: netbox:VirtualMachine    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.
    The following state arguments are supported:
    ClusterId double
    At least one of site_id or cluster_id must be given.
    Comments string
    CustomFields Dictionary<string, string>
    Description string
    DeviceId double
    DiskSizeMb double
    LocalContextData string
    This is best managed through the use of jsonencode and a map of settings.
    MemoryMb double
    Name string
    PlatformId double
    PrimaryIpv4 double
    PrimaryIpv6 double
    RoleId double
    SiteId double
    At least one of site_id or cluster_id must be given.
    Status string
    Valid values are offline, active, planned, staged, failed and decommissioning. Defaults to active.
    Tags List<string>
    TenantId double
    Vcpus double
    VirtualMachineId string
    The ID of this resource.
    ClusterId float64
    At least one of site_id or cluster_id must be given.
    Comments string
    CustomFields map[string]string
    Description string
    DeviceId float64
    DiskSizeMb float64
    LocalContextData string
    This is best managed through the use of jsonencode and a map of settings.
    MemoryMb float64
    Name string
    PlatformId float64
    PrimaryIpv4 float64
    PrimaryIpv6 float64
    RoleId float64
    SiteId float64
    At least one of site_id or cluster_id must be given.
    Status string
    Valid values are offline, active, planned, staged, failed and decommissioning. Defaults to active.
    Tags []string
    TenantId float64
    Vcpus float64
    VirtualMachineId string
    The ID of this resource.
    clusterId Double
    At least one of site_id or cluster_id must be given.
    comments String
    customFields Map<String,String>
    description String
    deviceId Double
    diskSizeMb Double
    localContextData String
    This is best managed through the use of jsonencode and a map of settings.
    memoryMb Double
    name String
    platformId Double
    primaryIpv4 Double
    primaryIpv6 Double
    roleId Double
    siteId Double
    At least one of site_id or cluster_id must be given.
    status String
    Valid values are offline, active, planned, staged, failed and decommissioning. Defaults to active.
    tags List<String>
    tenantId Double
    vcpus Double
    virtualMachineId String
    The ID of this resource.
    clusterId number
    At least one of site_id or cluster_id must be given.
    comments string
    customFields {[key: string]: string}
    description string
    deviceId number
    diskSizeMb number
    localContextData string
    This is best managed through the use of jsonencode and a map of settings.
    memoryMb number
    name string
    platformId number
    primaryIpv4 number
    primaryIpv6 number
    roleId number
    siteId number
    At least one of site_id or cluster_id must be given.
    status string
    Valid values are offline, active, planned, staged, failed and decommissioning. Defaults to active.
    tags string[]
    tenantId number
    vcpus number
    virtualMachineId string
    The ID of this resource.
    cluster_id float
    At least one of site_id or cluster_id must be given.
    comments str
    custom_fields Mapping[str, str]
    description str
    device_id float
    disk_size_mb float
    local_context_data str
    This is best managed through the use of jsonencode and a map of settings.
    memory_mb float
    name str
    platform_id float
    primary_ipv4 float
    primary_ipv6 float
    role_id float
    site_id float
    At least one of site_id or cluster_id must be given.
    status str
    Valid values are offline, active, planned, staged, failed and decommissioning. Defaults to active.
    tags Sequence[str]
    tenant_id float
    vcpus float
    virtual_machine_id str
    The ID of this resource.
    clusterId Number
    At least one of site_id or cluster_id must be given.
    comments String
    customFields Map<String>
    description String
    deviceId Number
    diskSizeMb Number
    localContextData String
    This is best managed through the use of jsonencode and a map of settings.
    memoryMb Number
    name String
    platformId Number
    primaryIpv4 Number
    primaryIpv6 Number
    roleId Number
    siteId Number
    At least one of site_id or cluster_id must be given.
    status String
    Valid values are offline, active, planned, staged, failed and decommissioning. Defaults to active.
    tags List<String>
    tenantId Number
    vcpus Number
    virtualMachineId String
    The ID of this resource.

    Package Details

    Repository
    netbox e-breuninger/terraform-provider-netbox
    License
    Notes
    This Pulumi package is based on the netbox Terraform Provider.
    netbox logo
    netbox 3.10.0 published on Monday, Apr 14, 2025 by e-breuninger