GetVirtualMachine
The vsphere..VirtualMachine data source can be used to find the UUID of an
existing virtual machine or template. Its most relevant purpose is for finding
the UUID of a template to be used as the source for cloning into a new
vsphere..VirtualMachine resource. It also
reads the guest ID so that can be supplied as well.
Example Usage
using Pulumi;
using VSphere = Pulumi.VSphere;
class MyStack : Stack
{
public MyStack()
{
var datacenter = Output.Create(VSphere.GetDatacenter.InvokeAsync(new VSphere.GetDatacenterArgs
{
Name = "dc1",
}));
var template = datacenter.Apply(datacenter => Output.Create(VSphere.GetVirtualMachine.InvokeAsync(new VSphere.GetVirtualMachineArgs
{
DatacenterId = datacenter.Id,
Name = "test-vm-template",
})));
}
}
Coming soon!
import pulumi
import pulumi_vsphere as vsphere
datacenter = vsphere.get_datacenter(name="dc1")
template = vsphere.get_virtual_machine(datacenter_id=datacenter.id,
name="test-vm-template")import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";
const datacenter = pulumi.output(vsphere.getDatacenter({
name: "dc1",
}, { async: true }));
const template = datacenter.apply(datacenter => vsphere.getVirtualMachine({
datacenterId: datacenter.id,
name: "test-vm-template",
}, { async: true }));Using GetVirtualMachine
function getVirtualMachine(args: GetVirtualMachineArgs, opts?: InvokeOptions): Promise<GetVirtualMachineResult>function get_virtual_machine(datacenter_id=None, ide_controller_scan_count=None, name=None, sata_controller_scan_count=None, scsi_controller_scan_count=None, opts=None)func LookupVirtualMachine(ctx *Context, args *LookupVirtualMachineArgs, opts ...InvokeOption) (*LookupVirtualMachineResult, error)Note: This function is named
LookupVirtualMachinein the Go SDK.
public static class GetVirtualMachine {
public static Task<GetVirtualMachineResult> InvokeAsync(GetVirtualMachineArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
- Name string
The name of the virtual machine. This can be a name or path.
- Datacenter
Id string The managed object reference ID of the datacenter the virtual machine is located in. This can be omitted if the search path used in
nameis an absolute path. For default datacenters, use theidattribute from an emptyvsphere..Datacenterdata source.- Ide
Controller intScan Count - Sata
Controller intScan Count - Scsi
Controller intScan Count The number of SCSI controllers to scan for disk attributes and controller types on. Default:
1.
- Name string
The name of the virtual machine. This can be a name or path.
- Datacenter
Id string The managed object reference ID of the datacenter the virtual machine is located in. This can be omitted if the search path used in
nameis an absolute path. For default datacenters, use theidattribute from an emptyvsphere..Datacenterdata source.- Ide
Controller intScan Count - Sata
Controller intScan Count - Scsi
Controller intScan Count The number of SCSI controllers to scan for disk attributes and controller types on. Default:
1.
- name string
The name of the virtual machine. This can be a name or path.
- datacenter
Id string The managed object reference ID of the datacenter the virtual machine is located in. This can be omitted if the search path used in
nameis an absolute path. For default datacenters, use theidattribute from an emptyvsphere..Datacenterdata source.- ide
Controller numberScan Count - sata
Controller numberScan Count - scsi
Controller numberScan Count The number of SCSI controllers to scan for disk attributes and controller types on. Default:
1.
- name str
The name of the virtual machine. This can be a name or path.
- datacenter_
id str The managed object reference ID of the datacenter the virtual machine is located in. This can be omitted if the search path used in
nameis an absolute path. For default datacenters, use theidattribute from an emptyvsphere..Datacenterdata source.- ide_
controller_ floatscan_ count - sata_
controller_ floatscan_ count - scsi_
controller_ floatscan_ count The number of SCSI controllers to scan for disk attributes and controller types on. Default:
1.
GetVirtualMachine Result
The following output properties are available:
- Alternate
Guest stringName The alternate guest name of the virtual machine when guest_id is a non-specific operating system, like
otherGuest.- Disks
List<Pulumi.
VSphere. Outputs. Get Virtual Machine Disk> Information about each of the disks on this virtual machine or template. These are sorted by bus and unit number so that they can be applied to a
vsphere..VirtualMachineresource in the order the resource expects while cloning. This is useful for discovering certain disk settings while performing a linked clone, as all settings that are output by this data source must be the same on the destination virtual machine as the source. Only the first number of controllers defined byscsi_controller_scan_countare scanned for disks. The sub-attributes are:- Firmware string
The firmware type for this virtual machine. Can be
biosorefi.- Guest
Id string The guest ID of the virtual machine or template.
- Guest
Ip List<string>Addresses A list of IP addresses as reported by VMWare tools.
- Id string
The provider-assigned unique ID for this managed resource.
- Name string
- Network
Interface List<string>Types The network interface types for each network interface found on the virtual machine, in device bus order. Will be one of
e1000,e1000e,pcnet32,sriov,vmxnet2, orvmxnet3.- Scsi
Bus stringSharing Mode for sharing the SCSI bus. The modes are physicalSharing, virtualSharing, and noSharing. Only the first number of controllers defined by
scsi_controller_scan_countare scanned.- Scsi
Type string The common type of all SCSI controllers on this virtual machine. Will be one of
lsilogic(LSI Logic Parallel),lsilogic-sas(LSI Logic SAS),pvscsi(VMware Paravirtual),buslogic(BusLogic), ormixedwhen there are multiple controller types. Only the first number of controllers defined byscsi_controller_scan_countare scanned.- Datacenter
Id string - Ide
Controller intScan Count - Sata
Controller intScan Count - Scsi
Controller intScan Count
- Alternate
Guest stringName The alternate guest name of the virtual machine when guest_id is a non-specific operating system, like
otherGuest.- Disks
[]Get
Virtual Machine Disk Information about each of the disks on this virtual machine or template. These are sorted by bus and unit number so that they can be applied to a
vsphere..VirtualMachineresource in the order the resource expects while cloning. This is useful for discovering certain disk settings while performing a linked clone, as all settings that are output by this data source must be the same on the destination virtual machine as the source. Only the first number of controllers defined byscsi_controller_scan_countare scanned for disks. The sub-attributes are:- Firmware string
The firmware type for this virtual machine. Can be
biosorefi.- Guest
Id string The guest ID of the virtual machine or template.
- Guest
Ip []stringAddresses A list of IP addresses as reported by VMWare tools.
- Id string
The provider-assigned unique ID for this managed resource.
- Name string
- Network
Interface []stringTypes The network interface types for each network interface found on the virtual machine, in device bus order. Will be one of
e1000,e1000e,pcnet32,sriov,vmxnet2, orvmxnet3.- Scsi
Bus stringSharing Mode for sharing the SCSI bus. The modes are physicalSharing, virtualSharing, and noSharing. Only the first number of controllers defined by
scsi_controller_scan_countare scanned.- Scsi
Type string The common type of all SCSI controllers on this virtual machine. Will be one of
lsilogic(LSI Logic Parallel),lsilogic-sas(LSI Logic SAS),pvscsi(VMware Paravirtual),buslogic(BusLogic), ormixedwhen there are multiple controller types. Only the first number of controllers defined byscsi_controller_scan_countare scanned.- Datacenter
Id string - Ide
Controller intScan Count - Sata
Controller intScan Count - Scsi
Controller intScan Count
- alternate
Guest stringName The alternate guest name of the virtual machine when guest_id is a non-specific operating system, like
otherGuest.- disks
Get
Virtual Machine Disk[] Information about each of the disks on this virtual machine or template. These are sorted by bus and unit number so that they can be applied to a
vsphere..VirtualMachineresource in the order the resource expects while cloning. This is useful for discovering certain disk settings while performing a linked clone, as all settings that are output by this data source must be the same on the destination virtual machine as the source. Only the first number of controllers defined byscsi_controller_scan_countare scanned for disks. The sub-attributes are:- firmware string
The firmware type for this virtual machine. Can be
biosorefi.- guest
Id string The guest ID of the virtual machine or template.
- guest
Ip string[]Addresses A list of IP addresses as reported by VMWare tools.
- id string
The provider-assigned unique ID for this managed resource.
- name string
- network
Interface string[]Types The network interface types for each network interface found on the virtual machine, in device bus order. Will be one of
e1000,e1000e,pcnet32,sriov,vmxnet2, orvmxnet3.- scsi
Bus stringSharing Mode for sharing the SCSI bus. The modes are physicalSharing, virtualSharing, and noSharing. Only the first number of controllers defined by
scsi_controller_scan_countare scanned.- scsi
Type string The common type of all SCSI controllers on this virtual machine. Will be one of
lsilogic(LSI Logic Parallel),lsilogic-sas(LSI Logic SAS),pvscsi(VMware Paravirtual),buslogic(BusLogic), ormixedwhen there are multiple controller types. Only the first number of controllers defined byscsi_controller_scan_countare scanned.- datacenter
Id string - ide
Controller numberScan Count - sata
Controller numberScan Count - scsi
Controller numberScan Count
- alternate_
guest_ strname The alternate guest name of the virtual machine when guest_id is a non-specific operating system, like
otherGuest.- disks
List[Get
Virtual Machine Disk] Information about each of the disks on this virtual machine or template. These are sorted by bus and unit number so that they can be applied to a
vsphere..VirtualMachineresource in the order the resource expects while cloning. This is useful for discovering certain disk settings while performing a linked clone, as all settings that are output by this data source must be the same on the destination virtual machine as the source. Only the first number of controllers defined byscsi_controller_scan_countare scanned for disks. The sub-attributes are:- firmware str
The firmware type for this virtual machine. Can be
biosorefi.- guest_
id str The guest ID of the virtual machine or template.
- guest_
ip_ List[str]addresses A list of IP addresses as reported by VMWare tools.
- id str
The provider-assigned unique ID for this managed resource.
- name str
- network_
interface_ List[str]types The network interface types for each network interface found on the virtual machine, in device bus order. Will be one of
e1000,e1000e,pcnet32,sriov,vmxnet2, orvmxnet3.- scsi_
bus_ strsharing Mode for sharing the SCSI bus. The modes are physicalSharing, virtualSharing, and noSharing. Only the first number of controllers defined by
scsi_controller_scan_countare scanned.- scsi_
type str The common type of all SCSI controllers on this virtual machine. Will be one of
lsilogic(LSI Logic Parallel),lsilogic-sas(LSI Logic SAS),pvscsi(VMware Paravirtual),buslogic(BusLogic), ormixedwhen there are multiple controller types. Only the first number of controllers defined byscsi_controller_scan_countare scanned.- datacenter_
id str - ide_
controller_ floatscan_ count - sata_
controller_ floatscan_ count - scsi_
controller_ floatscan_ count
Supporting Types
GetVirtualMachineDisk
See the output API doc for this type.
See the output API doc for this type.
See the output API doc for this type.
- Eagerly
Scrub bool Set to
trueif the disk has been eager zeroed.- Size int
The size of the disk, in GIB.
- Thin
Provisioned bool Set to
trueif the disk has been thin provisioned.
- Eagerly
Scrub bool Set to
trueif the disk has been eager zeroed.- Size int
The size of the disk, in GIB.
- Thin
Provisioned bool Set to
trueif the disk has been thin provisioned.
- eagerly
Scrub boolean Set to
trueif the disk has been eager zeroed.- size number
The size of the disk, in GIB.
- thin
Provisioned boolean Set to
trueif the disk has been thin provisioned.
- eagerly
Scrub bool Set to
trueif the disk has been eager zeroed.- size float
The size of the disk, in GIB.
- thin
Provisioned bool Set to
trueif the disk has been thin provisioned.
Package Details
- Repository
- https://github.com/pulumi/pulumi-vsphere
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
vsphereTerraform Provider.