netbox.VirtualDisk
Explore with Pulumi AI
From the official documentation:
> A virtual disk is used to model discrete virtual hard disks assigned to virtual machines.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as netbox from "@pulumi/netbox";
const vmwCluster01 = netbox.getCluster({
name: "vmw-cluster-01",
});
const baseVm = new netbox.VirtualMachine("baseVm", {clusterId: vmwCluster01.then(vmwCluster01 => vmwCluster01.id)});
const example = new netbox.VirtualDisk("example", {
description: "Main disk",
sizeMb: 50,
virtualMachineId: baseVm.virtualMachineId,
});
import pulumi
import pulumi_netbox as netbox
vmw_cluster01 = netbox.get_cluster(name="vmw-cluster-01")
base_vm = netbox.VirtualMachine("baseVm", cluster_id=vmw_cluster01.id)
example = netbox.VirtualDisk("example",
description="Main disk",
size_mb=50,
virtual_machine_id=base_vm.virtual_machine_id)
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/netbox/v3/netbox"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
vmwCluster01, err := netbox.LookupCluster(ctx, &netbox.LookupClusterArgs{
Name: pulumi.StringRef("vmw-cluster-01"),
}, nil)
if err != nil {
return err
}
baseVm, err := netbox.NewVirtualMachine(ctx, "baseVm", &netbox.VirtualMachineArgs{
ClusterId: pulumi.String(vmwCluster01.Id),
})
if err != nil {
return err
}
_, err = netbox.NewVirtualDisk(ctx, "example", &netbox.VirtualDiskArgs{
Description: pulumi.String("Main disk"),
SizeMb: pulumi.Float64(50),
VirtualMachineId: baseVm.VirtualMachineId,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Netbox = Pulumi.Netbox;
return await Deployment.RunAsync(() =>
{
var vmwCluster01 = Netbox.GetCluster.Invoke(new()
{
Name = "vmw-cluster-01",
});
var baseVm = new Netbox.VirtualMachine("baseVm", new()
{
ClusterId = vmwCluster01.Apply(getClusterResult => getClusterResult.Id),
});
var example = new Netbox.VirtualDisk("example", new()
{
Description = "Main disk",
SizeMb = 50,
VirtualMachineId = baseVm.VirtualMachineId,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.netbox.NetboxFunctions;
import com.pulumi.netbox.inputs.GetClusterArgs;
import com.pulumi.netbox.VirtualMachine;
import com.pulumi.netbox.VirtualMachineArgs;
import com.pulumi.netbox.VirtualDisk;
import com.pulumi.netbox.VirtualDiskArgs;
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 vmwCluster01 = NetboxFunctions.getCluster(GetClusterArgs.builder()
.name("vmw-cluster-01")
.build());
var baseVm = new VirtualMachine("baseVm", VirtualMachineArgs.builder()
.clusterId(vmwCluster01.applyValue(getClusterResult -> getClusterResult.id()))
.build());
var example = new VirtualDisk("example", VirtualDiskArgs.builder()
.description("Main disk")
.sizeMb(50)
.virtualMachineId(baseVm.virtualMachineId())
.build());
}
}
resources:
baseVm:
type: netbox:VirtualMachine
properties:
clusterId: ${vmwCluster01.id}
example:
type: netbox:VirtualDisk
properties:
description: Main disk
sizeMb: 50
virtualMachineId: ${baseVm.virtualMachineId}
variables:
vmwCluster01:
fn::invoke:
function: netbox:getCluster
arguments:
name: vmw-cluster-01
Create VirtualDisk Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new VirtualDisk(name: string, args: VirtualDiskArgs, opts?: CustomResourceOptions);
@overload
def VirtualDisk(resource_name: str,
args: VirtualDiskArgs,
opts: Optional[ResourceOptions] = None)
@overload
def VirtualDisk(resource_name: str,
opts: Optional[ResourceOptions] = None,
size_mb: Optional[float] = None,
virtual_machine_id: Optional[float] = None,
custom_fields: Optional[Mapping[str, str]] = None,
description: Optional[str] = None,
name: Optional[str] = None,
tags: Optional[Sequence[str]] = None,
virtual_disk_id: Optional[str] = None)
func NewVirtualDisk(ctx *Context, name string, args VirtualDiskArgs, opts ...ResourceOption) (*VirtualDisk, error)
public VirtualDisk(string name, VirtualDiskArgs args, CustomResourceOptions? opts = null)
public VirtualDisk(String name, VirtualDiskArgs args)
public VirtualDisk(String name, VirtualDiskArgs args, CustomResourceOptions options)
type: netbox:VirtualDisk
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 VirtualDiskArgs
- 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 VirtualDiskArgs
- 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 VirtualDiskArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args VirtualDiskArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args VirtualDiskArgs
- 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 virtualDiskResource = new Netbox.VirtualDisk("virtualDiskResource", new()
{
SizeMb = 0,
VirtualMachineId = 0,
CustomFields =
{
{ "string", "string" },
},
Description = "string",
Name = "string",
Tags = new[]
{
"string",
},
VirtualDiskId = "string",
});
example, err := netbox.NewVirtualDisk(ctx, "virtualDiskResource", &netbox.VirtualDiskArgs{
SizeMb: pulumi.Float64(0),
VirtualMachineId: pulumi.Float64(0),
CustomFields: pulumi.StringMap{
"string": pulumi.String("string"),
},
Description: pulumi.String("string"),
Name: pulumi.String("string"),
Tags: pulumi.StringArray{
pulumi.String("string"),
},
VirtualDiskId: pulumi.String("string"),
})
var virtualDiskResource = new VirtualDisk("virtualDiskResource", VirtualDiskArgs.builder()
.sizeMb(0)
.virtualMachineId(0)
.customFields(Map.of("string", "string"))
.description("string")
.name("string")
.tags("string")
.virtualDiskId("string")
.build());
virtual_disk_resource = netbox.VirtualDisk("virtualDiskResource",
size_mb=0,
virtual_machine_id=0,
custom_fields={
"string": "string",
},
description="string",
name="string",
tags=["string"],
virtual_disk_id="string")
const virtualDiskResource = new netbox.VirtualDisk("virtualDiskResource", {
sizeMb: 0,
virtualMachineId: 0,
customFields: {
string: "string",
},
description: "string",
name: "string",
tags: ["string"],
virtualDiskId: "string",
});
type: netbox:VirtualDisk
properties:
customFields:
string: string
description: string
name: string
sizeMb: 0
tags:
- string
virtualDiskId: string
virtualMachineId: 0
VirtualDisk 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 VirtualDisk resource accepts the following input properties:
- Size
Mb double - Virtual
Machine doubleId - Custom
Fields Dictionary<string, string> - Description string
- Name string
- List<string>
- Virtual
Disk stringId - The ID of this resource.
- Size
Mb float64 - Virtual
Machine float64Id - Custom
Fields map[string]string - Description string
- Name string
- []string
- Virtual
Disk stringId - The ID of this resource.
- size
Mb Double - virtual
Machine DoubleId - custom
Fields Map<String,String> - description String
- name String
- List<String>
- virtual
Disk StringId - The ID of this resource.
- size
Mb number - virtual
Machine numberId - custom
Fields {[key: string]: string} - description string
- name string
- string[]
- virtual
Disk stringId - The ID of this resource.
- size_
mb float - virtual_
machine_ floatid - custom_
fields Mapping[str, str] - description str
- name str
- Sequence[str]
- virtual_
disk_ strid - The ID of this resource.
- size
Mb Number - virtual
Machine NumberId - custom
Fields Map<String> - description String
- name String
- List<String>
- virtual
Disk StringId - The ID of this resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the VirtualDisk 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 VirtualDisk Resource
Get an existing VirtualDisk 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?: VirtualDiskState, opts?: CustomResourceOptions): VirtualDisk
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
custom_fields: Optional[Mapping[str, str]] = None,
description: Optional[str] = None,
name: Optional[str] = None,
size_mb: Optional[float] = None,
tags: Optional[Sequence[str]] = None,
virtual_disk_id: Optional[str] = None,
virtual_machine_id: Optional[float] = None) -> VirtualDisk
func GetVirtualDisk(ctx *Context, name string, id IDInput, state *VirtualDiskState, opts ...ResourceOption) (*VirtualDisk, error)
public static VirtualDisk Get(string name, Input<string> id, VirtualDiskState? state, CustomResourceOptions? opts = null)
public static VirtualDisk get(String name, Output<String> id, VirtualDiskState state, CustomResourceOptions options)
resources: _: type: netbox:VirtualDisk 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.
- Custom
Fields Dictionary<string, string> - Description string
- Name string
- Size
Mb double - List<string>
- Virtual
Disk stringId - The ID of this resource.
- Virtual
Machine doubleId
- Custom
Fields map[string]string - Description string
- Name string
- Size
Mb float64 - []string
- Virtual
Disk stringId - The ID of this resource.
- Virtual
Machine float64Id
- custom
Fields Map<String,String> - description String
- name String
- size
Mb Double - List<String>
- virtual
Disk StringId - The ID of this resource.
- virtual
Machine DoubleId
- custom
Fields {[key: string]: string} - description string
- name string
- size
Mb number - string[]
- virtual
Disk stringId - The ID of this resource.
- virtual
Machine numberId
- custom_
fields Mapping[str, str] - description str
- name str
- size_
mb float - Sequence[str]
- virtual_
disk_ strid - The ID of this resource.
- virtual_
machine_ floatid
- custom
Fields Map<String> - description String
- name String
- size
Mb Number - List<String>
- virtual
Disk StringId - The ID of this resource.
- virtual
Machine NumberId
Package Details
- Repository
- netbox e-breuninger/terraform-provider-netbox
- License
- Notes
- This Pulumi package is based on the
netbox
Terraform Provider.