1. Packages
  2. Proxmox Virtual Environment (Proxmox VE)
  3. API Docs
  4. VM
  5. getVirtualMachines
Proxmox Virtual Environment (Proxmox VE) v6.4.1 published on Sunday, Apr 21, 2024 by Daniel Muehlbachler-Pietrzykowski

proxmoxve.VM.getVirtualMachines

Explore with Pulumi AI

proxmoxve logo
Proxmox Virtual Environment (Proxmox VE) v6.4.1 published on Sunday, Apr 21, 2024 by Daniel Muehlbachler-Pietrzykowski

    Retrieves information about all VMs in the Proxmox cluster.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as proxmoxve from "@pulumi/proxmoxve";
    
    const ubuntuVms = proxmoxve.VM.getVirtualMachines({
        tags: ["ubuntu"],
    });
    
    import pulumi
    import pulumi_proxmoxve as proxmoxve
    
    ubuntu_vms = proxmoxve.VM.get_virtual_machines(tags=["ubuntu"])
    
    package main
    
    import (
    	"github.com/muhlba91/pulumi-proxmoxve/sdk/v6/go/proxmoxve/VM"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := VM.GetVirtualMachines(ctx, &vm.GetVirtualMachinesArgs{
    			Tags: []string{
    				"ubuntu",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using ProxmoxVE = Pulumi.ProxmoxVE;
    
    return await Deployment.RunAsync(() => 
    {
        var ubuntuVms = ProxmoxVE.VM.GetVirtualMachines.Invoke(new()
        {
            Tags = new[]
            {
                "ubuntu",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.proxmoxve.VM.VMFunctions;
    import com.pulumi.proxmoxve.VM.inputs.GetVirtualMachinesArgs;
    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 ubuntuVms = VMFunctions.getVirtualMachines(GetVirtualMachinesArgs.builder()
                .tags("ubuntu")
                .build());
    
        }
    }
    
    variables:
      ubuntuVms:
        fn::invoke:
          Function: proxmoxve:VM:getVirtualMachines
          Arguments:
            tags:
              - ubuntu
    

    Using getVirtualMachines

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getVirtualMachines(args: GetVirtualMachinesArgs, opts?: InvokeOptions): Promise<GetVirtualMachinesResult>
    function getVirtualMachinesOutput(args: GetVirtualMachinesOutputArgs, opts?: InvokeOptions): Output<GetVirtualMachinesResult>
    def get_virtual_machines(node_name: Optional[str] = None,
                             tags: Optional[Sequence[str]] = None,
                             opts: Optional[InvokeOptions] = None) -> GetVirtualMachinesResult
    def get_virtual_machines_output(node_name: Optional[pulumi.Input[str]] = None,
                             tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                             opts: Optional[InvokeOptions] = None) -> Output[GetVirtualMachinesResult]
    func GetVirtualMachines(ctx *Context, args *GetVirtualMachinesArgs, opts ...InvokeOption) (*GetVirtualMachinesResult, error)
    func GetVirtualMachinesOutput(ctx *Context, args *GetVirtualMachinesOutputArgs, opts ...InvokeOption) GetVirtualMachinesResultOutput

    > Note: This function is named GetVirtualMachines in the Go SDK.

    public static class GetVirtualMachines 
    {
        public static Task<GetVirtualMachinesResult> InvokeAsync(GetVirtualMachinesArgs args, InvokeOptions? opts = null)
        public static Output<GetVirtualMachinesResult> Invoke(GetVirtualMachinesInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetVirtualMachinesResult> getVirtualMachines(GetVirtualMachinesArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: proxmoxve:VM/getVirtualMachines:getVirtualMachines
      arguments:
        # arguments dictionary

    The following arguments are supported:

    NodeName string
    The node name.
    Tags List<string>
    A list of tags to filter the VMs. The VM must have all the tags to be included in the result.
    NodeName string
    The node name.
    Tags []string
    A list of tags to filter the VMs. The VM must have all the tags to be included in the result.
    nodeName String
    The node name.
    tags List<String>
    A list of tags to filter the VMs. The VM must have all the tags to be included in the result.
    nodeName string
    The node name.
    tags string[]
    A list of tags to filter the VMs. The VM must have all the tags to be included in the result.
    node_name str
    The node name.
    tags Sequence[str]
    A list of tags to filter the VMs. The VM must have all the tags to be included in the result.
    nodeName String
    The node name.
    tags List<String>
    A list of tags to filter the VMs. The VM must have all the tags to be included in the result.

    getVirtualMachines Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Vms List<Pulumi.ProxmoxVE.VM.Outputs.GetVirtualMachinesVm>
    The VMs list.
    NodeName string
    The node name.
    Tags List<string>
    A list of tags of the VM.
    Id string
    The provider-assigned unique ID for this managed resource.
    Vms []GetVirtualMachinesVm
    The VMs list.
    NodeName string
    The node name.
    Tags []string
    A list of tags of the VM.
    id String
    The provider-assigned unique ID for this managed resource.
    vms List<GetVirtualMachinesVm>
    The VMs list.
    nodeName String
    The node name.
    tags List<String>
    A list of tags of the VM.
    id string
    The provider-assigned unique ID for this managed resource.
    vms GetVirtualMachinesVm[]
    The VMs list.
    nodeName string
    The node name.
    tags string[]
    A list of tags of the VM.
    id str
    The provider-assigned unique ID for this managed resource.
    vms Sequence[vm.GetVirtualMachinesVm]
    The VMs list.
    node_name str
    The node name.
    tags Sequence[str]
    A list of tags of the VM.
    id String
    The provider-assigned unique ID for this managed resource.
    vms List<Property Map>
    The VMs list.
    nodeName String
    The node name.
    tags List<String>
    A list of tags of the VM.

    Supporting Types

    GetVirtualMachinesVm

    Name string
    The virtual machine name.
    NodeName string
    The node name.
    Tags List<string>
    A list of tags to filter the VMs. The VM must have all the tags to be included in the result.
    VmId int
    The VM identifier.
    Name string
    The virtual machine name.
    NodeName string
    The node name.
    Tags []string
    A list of tags to filter the VMs. The VM must have all the tags to be included in the result.
    VmId int
    The VM identifier.
    name String
    The virtual machine name.
    nodeName String
    The node name.
    tags List<String>
    A list of tags to filter the VMs. The VM must have all the tags to be included in the result.
    vmId Integer
    The VM identifier.
    name string
    The virtual machine name.
    nodeName string
    The node name.
    tags string[]
    A list of tags to filter the VMs. The VM must have all the tags to be included in the result.
    vmId number
    The VM identifier.
    name str
    The virtual machine name.
    node_name str
    The node name.
    tags Sequence[str]
    A list of tags to filter the VMs. The VM must have all the tags to be included in the result.
    vm_id int
    The VM identifier.
    name String
    The virtual machine name.
    nodeName String
    The node name.
    tags List<String>
    A list of tags to filter the VMs. The VM must have all the tags to be included in the result.
    vmId Number
    The VM identifier.

    Package Details

    Repository
    proxmoxve muhlba91/pulumi-proxmoxve
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the proxmox Terraform Provider.
    proxmoxve logo
    Proxmox Virtual Environment (Proxmox VE) v6.4.1 published on Sunday, Apr 21, 2024 by Daniel Muehlbachler-Pietrzykowski