1. Packages
  2. Proxmox Virtual Environment (Proxmox VE)
  3. API Docs
  4. getFile
Proxmox Virtual Environment (Proxmox VE) v7.7.0 published on Sunday, Oct 12, 2025 by Daniel Muehlbachler-Pietrzykowski

proxmoxve.getFile

Get Started
proxmoxve logo
Proxmox Virtual Environment (Proxmox VE) v7.7.0 published on Sunday, Oct 12, 2025 by Daniel Muehlbachler-Pietrzykowski

    Retrieves information about an existing file in a Proxmox Virtual Environment node.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as proxmoxve from "@muhlba91/pulumi-proxmoxve";
    
    const ubuntuIso = proxmoxve.getFile({
        nodeName: "pve",
        datastoreId: "local",
        contentType: "iso",
        fileName: "ubuntu-22.04.3-live-server-amd64.iso",
    });
    const ubuntuContainerTemplate = proxmoxve.getFile({
        nodeName: "pve",
        datastoreId: "local",
        contentType: "vztmpl",
        fileName: "ubuntu-22.04-standard_22.04-1_amd64.tar.zst",
    });
    const cloudInitSnippet = proxmoxve.getFile({
        nodeName: "pve",
        datastoreId: "local",
        contentType: "snippets",
        fileName: "cloud-init-config.yaml",
    });
    const importedFile = proxmoxve.getFile({
        nodeName: "pve",
        datastoreId: "local",
        contentType: "import",
        fileName: "imported-config.yaml",
    });
    export const ubuntuIsoId = ubuntuIso.then(ubuntuIso => ubuntuIso.id);
    export const ubuntuIsoSize = ubuntuIso.then(ubuntuIso => ubuntuIso.fileSize);
    export const containerTemplateFormat = ubuntuContainerTemplate.then(ubuntuContainerTemplate => ubuntuContainerTemplate.fileFormat);
    const example = new proxmoxve.vm.VirtualMachine("example", {
        nodeName: "pve",
        vmId: 100,
        cdrom: {
            fileId: ubuntuIso.then(ubuntuIso => ubuntuIso.id),
        },
        cpu: {
            cores: 2,
        },
        memory: {
            dedicated: 2048,
        },
        disks: [{
            datastoreId: "local-lvm",
            fileFormat: "qcow2",
            size: 20,
        }],
        networkDevices: [{
            bridge: "vmbr0",
        }],
    });
    
    import pulumi
    import pulumi_proxmoxve as proxmoxve
    
    ubuntu_iso = proxmoxve.get_file(node_name="pve",
        datastore_id="local",
        content_type="iso",
        file_name="ubuntu-22.04.3-live-server-amd64.iso")
    ubuntu_container_template = proxmoxve.get_file(node_name="pve",
        datastore_id="local",
        content_type="vztmpl",
        file_name="ubuntu-22.04-standard_22.04-1_amd64.tar.zst")
    cloud_init_snippet = proxmoxve.get_file(node_name="pve",
        datastore_id="local",
        content_type="snippets",
        file_name="cloud-init-config.yaml")
    imported_file = proxmoxve.get_file(node_name="pve",
        datastore_id="local",
        content_type="import",
        file_name="imported-config.yaml")
    pulumi.export("ubuntuIsoId", ubuntu_iso.id)
    pulumi.export("ubuntuIsoSize", ubuntu_iso.file_size)
    pulumi.export("containerTemplateFormat", ubuntu_container_template.file_format)
    example = proxmoxve.vm.VirtualMachine("example",
        node_name="pve",
        vm_id=100,
        cdrom={
            "file_id": ubuntu_iso.id,
        },
        cpu={
            "cores": 2,
        },
        memory={
            "dedicated": 2048,
        },
        disks=[{
            "datastore_id": "local-lvm",
            "file_format": "qcow2",
            "size": 20,
        }],
        network_devices=[{
            "bridge": "vmbr0",
        }])
    
    package main
    
    import (
    	"github.com/muhlba91/pulumi-proxmoxve/sdk/v7/go/proxmoxve"
    	"github.com/muhlba91/pulumi-proxmoxve/sdk/v7/go/proxmoxve/vm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		ubuntuIso, err := proxmoxve.GetFile(ctx, &proxmoxve.GetFileArgs{
    			NodeName:    "pve",
    			DatastoreId: "local",
    			ContentType: "iso",
    			FileName:    "ubuntu-22.04.3-live-server-amd64.iso",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ubuntuContainerTemplate, err := proxmoxve.GetFile(ctx, &proxmoxve.GetFileArgs{
    			NodeName:    "pve",
    			DatastoreId: "local",
    			ContentType: "vztmpl",
    			FileName:    "ubuntu-22.04-standard_22.04-1_amd64.tar.zst",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = proxmoxve.GetFile(ctx, &proxmoxve.GetFileArgs{
    			NodeName:    "pve",
    			DatastoreId: "local",
    			ContentType: "snippets",
    			FileName:    "cloud-init-config.yaml",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = proxmoxve.GetFile(ctx, &proxmoxve.GetFileArgs{
    			NodeName:    "pve",
    			DatastoreId: "local",
    			ContentType: "import",
    			FileName:    "imported-config.yaml",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("ubuntuIsoId", ubuntuIso.Id)
    		ctx.Export("ubuntuIsoSize", ubuntuIso.FileSize)
    		ctx.Export("containerTemplateFormat", ubuntuContainerTemplate.FileFormat)
    		_, err = vm.NewVirtualMachine(ctx, "example", &vm.VirtualMachineArgs{
    			NodeName: pulumi.String("pve"),
    			VmId:     pulumi.Int(100),
    			Cdrom: &vm.VirtualMachineCdromArgs{
    				FileId: pulumi.String(ubuntuIso.Id),
    			},
    			Cpu: &vm.VirtualMachineCpuArgs{
    				Cores: pulumi.Int(2),
    			},
    			Memory: &vm.VirtualMachineMemoryArgs{
    				Dedicated: pulumi.Int(2048),
    			},
    			Disks: vm.VirtualMachineDiskArray{
    				&vm.VirtualMachineDiskArgs{
    					DatastoreId: pulumi.String("local-lvm"),
    					FileFormat:  pulumi.String("qcow2"),
    					Size:        pulumi.Int(20),
    				},
    			},
    			NetworkDevices: vm.VirtualMachineNetworkDeviceArray{
    				&vm.VirtualMachineNetworkDeviceArgs{
    					Bridge: pulumi.String("vmbr0"),
    				},
    			},
    		})
    		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 ubuntuIso = ProxmoxVE.GetFile.Invoke(new()
        {
            NodeName = "pve",
            DatastoreId = "local",
            ContentType = "iso",
            FileName = "ubuntu-22.04.3-live-server-amd64.iso",
        });
    
        var ubuntuContainerTemplate = ProxmoxVE.GetFile.Invoke(new()
        {
            NodeName = "pve",
            DatastoreId = "local",
            ContentType = "vztmpl",
            FileName = "ubuntu-22.04-standard_22.04-1_amd64.tar.zst",
        });
    
        var cloudInitSnippet = ProxmoxVE.GetFile.Invoke(new()
        {
            NodeName = "pve",
            DatastoreId = "local",
            ContentType = "snippets",
            FileName = "cloud-init-config.yaml",
        });
    
        var importedFile = ProxmoxVE.GetFile.Invoke(new()
        {
            NodeName = "pve",
            DatastoreId = "local",
            ContentType = "import",
            FileName = "imported-config.yaml",
        });
    
        var example = new ProxmoxVE.VM.VirtualMachine("example", new()
        {
            NodeName = "pve",
            VmId = 100,
            Cdrom = new ProxmoxVE.VM.Inputs.VirtualMachineCdromArgs
            {
                FileId = ubuntuIso.Apply(getFileResult => getFileResult.Id),
            },
            Cpu = new ProxmoxVE.VM.Inputs.VirtualMachineCpuArgs
            {
                Cores = 2,
            },
            Memory = new ProxmoxVE.VM.Inputs.VirtualMachineMemoryArgs
            {
                Dedicated = 2048,
            },
            Disks = new[]
            {
                new ProxmoxVE.VM.Inputs.VirtualMachineDiskArgs
                {
                    DatastoreId = "local-lvm",
                    FileFormat = "qcow2",
                    Size = 20,
                },
            },
            NetworkDevices = new[]
            {
                new ProxmoxVE.VM.Inputs.VirtualMachineNetworkDeviceArgs
                {
                    Bridge = "vmbr0",
                },
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["ubuntuIsoId"] = ubuntuIso.Apply(getFileResult => getFileResult.Id),
            ["ubuntuIsoSize"] = ubuntuIso.Apply(getFileResult => getFileResult.FileSize),
            ["containerTemplateFormat"] = ubuntuContainerTemplate.Apply(getFileResult => getFileResult.FileFormat),
        };
    });
    
    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.GetFileArgs;
    import io.muehlbachler.pulumi.proxmoxve.VM.VirtualMachine;
    import io.muehlbachler.pulumi.proxmoxve.VM.VirtualMachineArgs;
    import com.pulumi.proxmoxve.VM.inputs.VirtualMachineCdromArgs;
    import com.pulumi.proxmoxve.VM.inputs.VirtualMachineCpuArgs;
    import com.pulumi.proxmoxve.VM.inputs.VirtualMachineMemoryArgs;
    import com.pulumi.proxmoxve.VM.inputs.VirtualMachineDiskArgs;
    import com.pulumi.proxmoxve.VM.inputs.VirtualMachineNetworkDeviceArgs;
    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 ubuntuIso = ProxmoxveFunctions.getFile(GetFileArgs.builder()
                .nodeName("pve")
                .datastoreId("local")
                .contentType("iso")
                .fileName("ubuntu-22.04.3-live-server-amd64.iso")
                .build());
    
            final var ubuntuContainerTemplate = ProxmoxveFunctions.getFile(GetFileArgs.builder()
                .nodeName("pve")
                .datastoreId("local")
                .contentType("vztmpl")
                .fileName("ubuntu-22.04-standard_22.04-1_amd64.tar.zst")
                .build());
    
            final var cloudInitSnippet = ProxmoxveFunctions.getFile(GetFileArgs.builder()
                .nodeName("pve")
                .datastoreId("local")
                .contentType("snippets")
                .fileName("cloud-init-config.yaml")
                .build());
    
            final var importedFile = ProxmoxveFunctions.getFile(GetFileArgs.builder()
                .nodeName("pve")
                .datastoreId("local")
                .contentType("import")
                .fileName("imported-config.yaml")
                .build());
    
            ctx.export("ubuntuIsoId", ubuntuIso.id());
            ctx.export("ubuntuIsoSize", ubuntuIso.fileSize());
            ctx.export("containerTemplateFormat", ubuntuContainerTemplate.fileFormat());
            var example = new VirtualMachine("example", VirtualMachineArgs.builder()
                .nodeName("pve")
                .vmId(100)
                .cdrom(VirtualMachineCdromArgs.builder()
                    .fileId(ubuntuIso.id())
                    .build())
                .cpu(VirtualMachineCpuArgs.builder()
                    .cores(2)
                    .build())
                .memory(VirtualMachineMemoryArgs.builder()
                    .dedicated(2048)
                    .build())
                .disks(VirtualMachineDiskArgs.builder()
                    .datastoreId("local-lvm")
                    .fileFormat("qcow2")
                    .size(20)
                    .build())
                .networkDevices(VirtualMachineNetworkDeviceArgs.builder()
                    .bridge("vmbr0")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: proxmoxve:VM:VirtualMachine
        properties:
          nodeName: pve
          vmId: 100
          cdrom:
            fileId: ${ubuntuIso.id}
          cpu:
            cores: 2
          memory:
            dedicated: 2048
          disks:
            - datastoreId: local-lvm
              fileFormat: qcow2
              size: 20
          networkDevices:
            - bridge: vmbr0
    variables:
      ubuntuIso:
        fn::invoke:
          function: proxmoxve:getFile
          arguments:
            nodeName: pve
            datastoreId: local
            contentType: iso
            fileName: ubuntu-22.04.3-live-server-amd64.iso
      ubuntuContainerTemplate:
        fn::invoke:
          function: proxmoxve:getFile
          arguments:
            nodeName: pve
            datastoreId: local
            contentType: vztmpl
            fileName: ubuntu-22.04-standard_22.04-1_amd64.tar.zst
      cloudInitSnippet:
        fn::invoke:
          function: proxmoxve:getFile
          arguments:
            nodeName: pve
            datastoreId: local
            contentType: snippets
            fileName: cloud-init-config.yaml
      importedFile:
        fn::invoke:
          function: proxmoxve:getFile
          arguments:
            nodeName: pve
            datastoreId: local
            contentType: import
            fileName: imported-config.yaml
    outputs:
      ubuntuIsoId: ${ubuntuIso.id}
      ubuntuIsoSize: ${ubuntuIso.fileSize}
      containerTemplateFormat: ${ubuntuContainerTemplate.fileFormat}
    

    Using getFile

    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 getFile(args: GetFileArgs, opts?: InvokeOptions): Promise<GetFileResult>
    function getFileOutput(args: GetFileOutputArgs, opts?: InvokeOptions): Output<GetFileResult>
    def get_file(content_type: Optional[str] = None,
                 datastore_id: Optional[str] = None,
                 file_name: Optional[str] = None,
                 node_name: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetFileResult
    def get_file_output(content_type: Optional[pulumi.Input[str]] = None,
                 datastore_id: Optional[pulumi.Input[str]] = None,
                 file_name: Optional[pulumi.Input[str]] = None,
                 node_name: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetFileResult]
    func GetFile(ctx *Context, args *GetFileArgs, opts ...InvokeOption) (*GetFileResult, error)
    func GetFileOutput(ctx *Context, args *GetFileOutputArgs, opts ...InvokeOption) GetFileResultOutput

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

    public static class GetFile 
    {
        public static Task<GetFileResult> InvokeAsync(GetFileArgs args, InvokeOptions? opts = null)
        public static Output<GetFileResult> Invoke(GetFileInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetFileResult> getFile(GetFileArgs args, InvokeOptions options)
    public static Output<GetFileResult> getFile(GetFileArgs args, InvokeOptions options)
    
    fn::invoke:
      function: proxmoxve:index/getFile:getFile
      arguments:
        # arguments dictionary

    The following arguments are supported:

    ContentType string
    The content type of the file.
    DatastoreId string
    The identifier of the datastore.
    FileName string
    The name of the file.
    NodeName string
    The name of the node.
    ContentType string
    The content type of the file.
    DatastoreId string
    The identifier of the datastore.
    FileName string
    The name of the file.
    NodeName string
    The name of the node.
    contentType String
    The content type of the file.
    datastoreId String
    The identifier of the datastore.
    fileName String
    The name of the file.
    nodeName String
    The name of the node.
    contentType string
    The content type of the file.
    datastoreId string
    The identifier of the datastore.
    fileName string
    The name of the file.
    nodeName string
    The name of the node.
    content_type str
    The content type of the file.
    datastore_id str
    The identifier of the datastore.
    file_name str
    The name of the file.
    node_name str
    The name of the node.
    contentType String
    The content type of the file.
    datastoreId String
    The identifier of the datastore.
    fileName String
    The name of the file.
    nodeName String
    The name of the node.

    getFile Result

    The following output properties are available:

    ContentType string
    The content type of the file.
    DatastoreId string
    The identifier of the datastore.
    FileFormat string
    The format of the file.
    FileName string
    The name of the file.
    FileSize int
    The size of the file in bytes.
    Id string
    The unique identifier of the file (volume ID).
    NodeName string
    The name of the node.
    Vmid int
    The VM ID associated with the file (if applicable).
    ContentType string
    The content type of the file.
    DatastoreId string
    The identifier of the datastore.
    FileFormat string
    The format of the file.
    FileName string
    The name of the file.
    FileSize int
    The size of the file in bytes.
    Id string
    The unique identifier of the file (volume ID).
    NodeName string
    The name of the node.
    Vmid int
    The VM ID associated with the file (if applicable).
    contentType String
    The content type of the file.
    datastoreId String
    The identifier of the datastore.
    fileFormat String
    The format of the file.
    fileName String
    The name of the file.
    fileSize Integer
    The size of the file in bytes.
    id String
    The unique identifier of the file (volume ID).
    nodeName String
    The name of the node.
    vmid Integer
    The VM ID associated with the file (if applicable).
    contentType string
    The content type of the file.
    datastoreId string
    The identifier of the datastore.
    fileFormat string
    The format of the file.
    fileName string
    The name of the file.
    fileSize number
    The size of the file in bytes.
    id string
    The unique identifier of the file (volume ID).
    nodeName string
    The name of the node.
    vmid number
    The VM ID associated with the file (if applicable).
    content_type str
    The content type of the file.
    datastore_id str
    The identifier of the datastore.
    file_format str
    The format of the file.
    file_name str
    The name of the file.
    file_size int
    The size of the file in bytes.
    id str
    The unique identifier of the file (volume ID).
    node_name str
    The name of the node.
    vmid int
    The VM ID associated with the file (if applicable).
    contentType String
    The content type of the file.
    datastoreId String
    The identifier of the datastore.
    fileFormat String
    The format of the file.
    fileName String
    The name of the file.
    fileSize Number
    The size of the file in bytes.
    id String
    The unique identifier of the file (volume ID).
    nodeName String
    The name of the node.
    vmid Number
    The VM ID associated with the file (if applicable).

    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.7.0 published on Sunday, Oct 12, 2025 by Daniel Muehlbachler-Pietrzykowski
      Meet Neo: Your AI Platform Teammate