1. Packages
  2. Proxmox Virtual Environment (Proxmox VE)
  3. API Docs
  4. getContainers
Proxmox Virtual Environment (Proxmox VE) v7.5.0 published on Tuesday, Aug 26, 2025 by Daniel Muehlbachler-Pietrzykowski

proxmoxve.getContainers

Explore with Pulumi AI

proxmoxve logo
Proxmox Virtual Environment (Proxmox VE) v7.5.0 published on Tuesday, Aug 26, 2025 by Daniel Muehlbachler-Pietrzykowski

    Retrieves information about all containers in the Proxmox cluster.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as proxmoxve from "@muhlba91/pulumi-proxmoxve";
    
    const ubuntuContainers = proxmoxve.getContainers({
        tags: ["ubuntu"],
    });
    const ubuntuTemplates = proxmoxve.getContainers({
        filters: [
            {
                name: "template",
                values: ["true"],
            },
            {
                name: "status",
                values: ["stopped"],
            },
            {
                name: "name",
                regex: true,
                values: ["^ubuntu-20.*$"],
            },
            {
                name: "node_name",
                regex: true,
                values: [
                    "node_us_[1-3]",
                    "node_eu_[1-3]",
                ],
            },
        ],
        tags: [
            "template",
            "latest",
        ],
    });
    
    import pulumi
    import pulumi_proxmoxve as proxmoxve
    
    ubuntu_containers = proxmoxve.get_containers(tags=["ubuntu"])
    ubuntu_templates = proxmoxve.get_containers(filters=[
            {
                "name": "template",
                "values": ["true"],
            },
            {
                "name": "status",
                "values": ["stopped"],
            },
            {
                "name": "name",
                "regex": True,
                "values": ["^ubuntu-20.*$"],
            },
            {
                "name": "node_name",
                "regex": True,
                "values": [
                    "node_us_[1-3]",
                    "node_eu_[1-3]",
                ],
            },
        ],
        tags=[
            "template",
            "latest",
        ])
    
    package main
    
    import (
    	"github.com/muhlba91/pulumi-proxmoxve/sdk/v7/go/proxmoxve"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := proxmoxve.GetContainers(ctx, &proxmoxve.GetContainersArgs{
    			Tags: []string{
    				"ubuntu",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = proxmoxve.GetContainers(ctx, &proxmoxve.GetContainersArgs{
    			Filters: []proxmoxve.GetContainersFilter{
    				{
    					Name: "template",
    					Values: []string{
    						"true",
    					},
    				},
    				{
    					Name: "status",
    					Values: []string{
    						"stopped",
    					},
    				},
    				{
    					Name:  "name",
    					Regex: pulumi.BoolRef(true),
    					Values: []string{
    						"^ubuntu-20.*$",
    					},
    				},
    				{
    					Name:  "node_name",
    					Regex: pulumi.BoolRef(true),
    					Values: []string{
    						"node_us_[1-3]",
    						"node_eu_[1-3]",
    					},
    				},
    			},
    			Tags: []string{
    				"template",
    				"latest",
    			},
    		}, 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 ubuntuContainers = ProxmoxVE.GetContainers.Invoke(new()
        {
            Tags = new[]
            {
                "ubuntu",
            },
        });
    
        var ubuntuTemplates = ProxmoxVE.GetContainers.Invoke(new()
        {
            Filters = new[]
            {
                new ProxmoxVE.Inputs.GetContainersFilterInputArgs
                {
                    Name = "template",
                    Values = new[]
                    {
                        "true",
                    },
                },
                new ProxmoxVE.Inputs.GetContainersFilterInputArgs
                {
                    Name = "status",
                    Values = new[]
                    {
                        "stopped",
                    },
                },
                new ProxmoxVE.Inputs.GetContainersFilterInputArgs
                {
                    Name = "name",
                    Regex = true,
                    Values = new[]
                    {
                        "^ubuntu-20.*$",
                    },
                },
                new ProxmoxVE.Inputs.GetContainersFilterInputArgs
                {
                    Name = "node_name",
                    Regex = true,
                    Values = new[]
                    {
                        "node_us_[1-3]",
                        "node_eu_[1-3]",
                    },
                },
            },
            Tags = new[]
            {
                "template",
                "latest",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.proxmoxve.ProxmoxveFunctions;
    import com.pulumi.proxmoxve.inputs.GetContainersArgs;
    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 ubuntuContainers = ProxmoxveFunctions.getContainers(GetContainersArgs.builder()
                .tags("ubuntu")
                .build());
    
            final var ubuntuTemplates = ProxmoxveFunctions.getContainers(GetContainersArgs.builder()
                .filters(            
                    GetContainersFilterArgs.builder()
                        .name("template")
                        .values("true")
                        .build(),
                    GetContainersFilterArgs.builder()
                        .name("status")
                        .values("stopped")
                        .build(),
                    GetContainersFilterArgs.builder()
                        .name("name")
                        .regex(true)
                        .values("^ubuntu-20.*$")
                        .build(),
                    GetContainersFilterArgs.builder()
                        .name("node_name")
                        .regex(true)
                        .values(                    
                            "node_us_[1-3]",
                            "node_eu_[1-3]")
                        .build())
                .tags(            
                    "template",
                    "latest")
                .build());
    
        }
    }
    
    variables:
      ubuntuContainers:
        fn::invoke:
          function: proxmoxve:getContainers
          arguments:
            tags:
              - ubuntu
      ubuntuTemplates:
        fn::invoke:
          function: proxmoxve:getContainers
          arguments:
            filters:
              - name: template
                values:
                  - true
              - name: status
                values:
                  - stopped
              - name: name
                regex: true
                values:
                  - ^ubuntu-20.*$
              - name: node_name
                regex: true
                values:
                  - node_us_[1-3]
                  - node_eu_[1-3]
            tags:
              - template
              - latest
    

    Using getContainers

    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 getContainers(args: GetContainersArgs, opts?: InvokeOptions): Promise<GetContainersResult>
    function getContainersOutput(args: GetContainersOutputArgs, opts?: InvokeOptions): Output<GetContainersResult>
    def get_containers(filters: Optional[Sequence[GetContainersFilter]] = None,
                       node_name: Optional[str] = None,
                       tags: Optional[Sequence[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> GetContainersResult
    def get_containers_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetContainersFilterArgs]]]] = None,
                       node_name: Optional[pulumi.Input[str]] = None,
                       tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetContainersResult]
    func GetContainers(ctx *Context, args *GetContainersArgs, opts ...InvokeOption) (*GetContainersResult, error)
    func GetContainersOutput(ctx *Context, args *GetContainersOutputArgs, opts ...InvokeOption) GetContainersResultOutput

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

    public static class GetContainers 
    {
        public static Task<GetContainersResult> InvokeAsync(GetContainersArgs args, InvokeOptions? opts = null)
        public static Output<GetContainersResult> Invoke(GetContainersInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetContainersResult> getContainers(GetContainersArgs args, InvokeOptions options)
    public static Output<GetContainersResult> getContainers(GetContainersArgs args, InvokeOptions options)
    
    fn::invoke:
      function: proxmoxve:index/getContainers:getContainers
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Filters List<Pulumi.ProxmoxVE.Inputs.GetContainersFilter>
    Filter blocks. The container must satisfy all filter blocks to be included in the result.
    NodeName string
    The node name. All cluster nodes will be queried in case this is omitted
    Tags List<string>
    A list of tags to filter the containers. The container must have all the tags to be included in the result.
    Filters []GetContainersFilter
    Filter blocks. The container must satisfy all filter blocks to be included in the result.
    NodeName string
    The node name. All cluster nodes will be queried in case this is omitted
    Tags []string
    A list of tags to filter the containers. The container must have all the tags to be included in the result.
    filters List<GetContainersFilter>
    Filter blocks. The container must satisfy all filter blocks to be included in the result.
    nodeName String
    The node name. All cluster nodes will be queried in case this is omitted
    tags List<String>
    A list of tags to filter the containers. The container must have all the tags to be included in the result.
    filters GetContainersFilter[]
    Filter blocks. The container must satisfy all filter blocks to be included in the result.
    nodeName string
    The node name. All cluster nodes will be queried in case this is omitted
    tags string[]
    A list of tags to filter the containers. The container must have all the tags to be included in the result.
    filters Sequence[GetContainersFilter]
    Filter blocks. The container must satisfy all filter blocks to be included in the result.
    node_name str
    The node name. All cluster nodes will be queried in case this is omitted
    tags Sequence[str]
    A list of tags to filter the containers. The container must have all the tags to be included in the result.
    filters List<Property Map>
    Filter blocks. The container must satisfy all filter blocks to be included in the result.
    nodeName String
    The node name. All cluster nodes will be queried in case this is omitted
    tags List<String>
    A list of tags to filter the containers. The container must have all the tags to be included in the result.

    getContainers Result

    The following output properties are available:

    Containers List<Pulumi.ProxmoxVE.Outputs.GetContainersContainer>
    The containers list.
    Id string
    The provider-assigned unique ID for this managed resource.
    Filters List<Pulumi.ProxmoxVE.Outputs.GetContainersFilter>
    NodeName string
    The node name.
    Tags List<string>
    A list of tags of the container.
    Containers []GetContainersContainer
    The containers list.
    Id string
    The provider-assigned unique ID for this managed resource.
    Filters []GetContainersFilter
    NodeName string
    The node name.
    Tags []string
    A list of tags of the container.
    containers List<GetContainersContainer>
    The containers list.
    id String
    The provider-assigned unique ID for this managed resource.
    filters List<GetContainersFilter>
    nodeName String
    The node name.
    tags List<String>
    A list of tags of the container.
    containers GetContainersContainer[]
    The containers list.
    id string
    The provider-assigned unique ID for this managed resource.
    filters GetContainersFilter[]
    nodeName string
    The node name.
    tags string[]
    A list of tags of the container.
    containers Sequence[GetContainersContainer]
    The containers list.
    id str
    The provider-assigned unique ID for this managed resource.
    filters Sequence[GetContainersFilter]
    node_name str
    The node name.
    tags Sequence[str]
    A list of tags of the container.
    containers List<Property Map>
    The containers list.
    id String
    The provider-assigned unique ID for this managed resource.
    filters List<Property Map>
    nodeName String
    The node name.
    tags List<String>
    A list of tags of the container.

    Supporting Types

    GetContainersContainer

    Name string
    The container name.
    NodeName string
    The node name. All cluster nodes will be queried in case this is omitted
    Tags List<string>
    A list of tags to filter the containers. The container must have all the tags to be included in the result.
    VmId int
    The container identifier.
    Status string
    Status of the container
    Template bool
    Is container a template (true) or a regular container (false)
    Name string
    The container name.
    NodeName string
    The node name. All cluster nodes will be queried in case this is omitted
    Tags []string
    A list of tags to filter the containers. The container must have all the tags to be included in the result.
    VmId int
    The container identifier.
    Status string
    Status of the container
    Template bool
    Is container a template (true) or a regular container (false)
    name String
    The container name.
    nodeName String
    The node name. All cluster nodes will be queried in case this is omitted
    tags List<String>
    A list of tags to filter the containers. The container must have all the tags to be included in the result.
    vmId Integer
    The container identifier.
    status String
    Status of the container
    template Boolean
    Is container a template (true) or a regular container (false)
    name string
    The container name.
    nodeName string
    The node name. All cluster nodes will be queried in case this is omitted
    tags string[]
    A list of tags to filter the containers. The container must have all the tags to be included in the result.
    vmId number
    The container identifier.
    status string
    Status of the container
    template boolean
    Is container a template (true) or a regular container (false)
    name str
    The container name.
    node_name str
    The node name. All cluster nodes will be queried in case this is omitted
    tags Sequence[str]
    A list of tags to filter the containers. The container must have all the tags to be included in the result.
    vm_id int
    The container identifier.
    status str
    Status of the container
    template bool
    Is container a template (true) or a regular container (false)
    name String
    The container name.
    nodeName String
    The node name. All cluster nodes will be queried in case this is omitted
    tags List<String>
    A list of tags to filter the containers. The container must have all the tags to be included in the result.
    vmId Number
    The container identifier.
    status String
    Status of the container
    template Boolean
    Is container a template (true) or a regular container (false)

    GetContainersFilter

    Name string
    Name of the container attribute to filter on. One of [name, template, status, node_name]
    Values List<string>
    List of values to pass the filter. Container's attribute should match at least one value in the list.
    Regex bool
    Treat values as regex patterns
    Name string
    Name of the container attribute to filter on. One of [name, template, status, node_name]
    Values []string
    List of values to pass the filter. Container's attribute should match at least one value in the list.
    Regex bool
    Treat values as regex patterns
    name String
    Name of the container attribute to filter on. One of [name, template, status, node_name]
    values List<String>
    List of values to pass the filter. Container's attribute should match at least one value in the list.
    regex Boolean
    Treat values as regex patterns
    name string
    Name of the container attribute to filter on. One of [name, template, status, node_name]
    values string[]
    List of values to pass the filter. Container's attribute should match at least one value in the list.
    regex boolean
    Treat values as regex patterns
    name str
    Name of the container attribute to filter on. One of [name, template, status, node_name]
    values Sequence[str]
    List of values to pass the filter. Container's attribute should match at least one value in the list.
    regex bool
    Treat values as regex patterns
    name String
    Name of the container attribute to filter on. One of [name, template, status, node_name]
    values List<String>
    List of values to pass the filter. Container's attribute should match at least one value in the list.
    regex Boolean
    Treat values as regex patterns

    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) v7.5.0 published on Tuesday, Aug 26, 2025 by Daniel Muehlbachler-Pietrzykowski