Viewing docs for Hetzner Cloud v1.32.1
published on Tuesday, Feb 17, 2026 by Pulumi
published on Tuesday, Feb 17, 2026 by Pulumi
Viewing docs for Hetzner Cloud v1.32.1
published on Tuesday, Feb 17, 2026 by Pulumi
published on Tuesday, Feb 17, 2026 by Pulumi
Provides details about a Hetzner Cloud volume. This resource is useful if you want to use a non-terraform managed volume.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";
const volume1 = hcloud.getVolume({
id: 1234,
});
const volume2 = hcloud.getVolume({
name: "my-volume",
});
const volume3 = hcloud.getVolume({
withSelector: "key=value",
});
import pulumi
import pulumi_hcloud as hcloud
volume1 = hcloud.get_volume(id=1234)
volume2 = hcloud.get_volume(name="my-volume")
volume3 = hcloud.get_volume(with_selector="key=value")
package main
import (
"github.com/pulumi/pulumi-hcloud/sdk/go/hcloud"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := hcloud.LookupVolume(ctx, &hcloud.LookupVolumeArgs{
Id: pulumi.IntRef(1234),
}, nil)
if err != nil {
return err
}
_, err = hcloud.LookupVolume(ctx, &hcloud.LookupVolumeArgs{
Name: pulumi.StringRef("my-volume"),
}, nil)
if err != nil {
return err
}
_, err = hcloud.LookupVolume(ctx, &hcloud.LookupVolumeArgs{
WithSelector: pulumi.StringRef("key=value"),
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using HCloud = Pulumi.HCloud;
return await Deployment.RunAsync(() =>
{
var volume1 = HCloud.GetVolume.Invoke(new()
{
Id = 1234,
});
var volume2 = HCloud.GetVolume.Invoke(new()
{
Name = "my-volume",
});
var volume3 = HCloud.GetVolume.Invoke(new()
{
WithSelector = "key=value",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.hcloud.HcloudFunctions;
import com.pulumi.hcloud.inputs.GetVolumeArgs;
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 volume1 = HcloudFunctions.getVolume(GetVolumeArgs.builder()
.id(1234)
.build());
final var volume2 = HcloudFunctions.getVolume(GetVolumeArgs.builder()
.name("my-volume")
.build());
final var volume3 = HcloudFunctions.getVolume(GetVolumeArgs.builder()
.withSelector("key=value")
.build());
}
}
variables:
volume1:
fn::invoke:
function: hcloud:getVolume
arguments:
id: '1234'
volume2:
fn::invoke:
function: hcloud:getVolume
arguments:
name: my-volume
volume3:
fn::invoke:
function: hcloud:getVolume
arguments:
withSelector: key=value
Using getVolume
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 getVolume(args: GetVolumeArgs, opts?: InvokeOptions): Promise<GetVolumeResult>
function getVolumeOutput(args: GetVolumeOutputArgs, opts?: InvokeOptions): Output<GetVolumeResult>def get_volume(id: Optional[int] = None,
location: Optional[str] = None,
name: Optional[str] = None,
selector: Optional[str] = None,
server_id: Optional[int] = None,
with_selector: Optional[str] = None,
with_statuses: Optional[Sequence[str]] = None,
opts: Optional[InvokeOptions] = None) -> GetVolumeResult
def get_volume_output(id: Optional[pulumi.Input[int]] = None,
location: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
selector: Optional[pulumi.Input[str]] = None,
server_id: Optional[pulumi.Input[int]] = None,
with_selector: Optional[pulumi.Input[str]] = None,
with_statuses: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetVolumeResult]func LookupVolume(ctx *Context, args *LookupVolumeArgs, opts ...InvokeOption) (*LookupVolumeResult, error)
func LookupVolumeOutput(ctx *Context, args *LookupVolumeOutputArgs, opts ...InvokeOption) LookupVolumeResultOutput> Note: This function is named LookupVolume in the Go SDK.
public static class GetVolume
{
public static Task<GetVolumeResult> InvokeAsync(GetVolumeArgs args, InvokeOptions? opts = null)
public static Output<GetVolumeResult> Invoke(GetVolumeInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetVolumeResult> getVolume(GetVolumeArgs args, InvokeOptions options)
public static Output<GetVolumeResult> getVolume(GetVolumeArgs args, InvokeOptions options)
fn::invoke:
function: hcloud:index/getVolume:getVolume
arguments:
# arguments dictionaryThe following arguments are supported:
- Id int
- ID of the volume.
- Location string
- (string) The location name. See the Hetzner Docs for more details about locations.
- Name string
- Name of the volume.
- Selector string
- Server
Id int - (Optional, int) Server ID the volume is attached to
- With
Selector string - Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- With
Statuses List<string> - List only volumes with the specified status, could contain
creatingoravailable.
- Id int
- ID of the volume.
- Location string
- (string) The location name. See the Hetzner Docs for more details about locations.
- Name string
- Name of the volume.
- Selector string
- Server
Id int - (Optional, int) Server ID the volume is attached to
- With
Selector string - Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- With
Statuses []string - List only volumes with the specified status, could contain
creatingoravailable.
- id Integer
- ID of the volume.
- location String
- (string) The location name. See the Hetzner Docs for more details about locations.
- name String
- Name of the volume.
- selector String
- server
Id Integer - (Optional, int) Server ID the volume is attached to
- with
Selector String - Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- with
Statuses List<String> - List only volumes with the specified status, could contain
creatingoravailable.
- id number
- ID of the volume.
- location string
- (string) The location name. See the Hetzner Docs for more details about locations.
- name string
- Name of the volume.
- selector string
- server
Id number - (Optional, int) Server ID the volume is attached to
- with
Selector string - Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- with
Statuses string[] - List only volumes with the specified status, could contain
creatingoravailable.
- id int
- ID of the volume.
- location str
- (string) The location name. See the Hetzner Docs for more details about locations.
- name str
- Name of the volume.
- selector str
- server_
id int - (Optional, int) Server ID the volume is attached to
- with_
selector str - Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- with_
statuses Sequence[str] - List only volumes with the specified status, could contain
creatingoravailable.
- id Number
- ID of the volume.
- location String
- (string) The location name. See the Hetzner Docs for more details about locations.
- name String
- Name of the volume.
- selector String
- server
Id Number - (Optional, int) Server ID the volume is attached to
- with
Selector String - Label Selector. For more information about possible values, visit the Hetzner Cloud Documentation.
- with
Statuses List<String> - List only volumes with the specified status, could contain
creatingoravailable.
getVolume Result
The following output properties are available:
- Delete
Protection bool - (bool) Whether delete protection is enabled.
- Id int
- (int) Unique ID of the volume.
- Labels Dictionary<string, string>
- (map) User-defined labels (key-value pairs).
- Linux
Device string - (string) Device path on the file system for the Volume.
- Name string
- (string) Name of the volume.
- Size int
- (int) Size of the volume.
- Location string
- (string) The location name. See the Hetzner Docs for more details about locations.
- Selector string
- Server
Id int - (Optional, int) Server ID the volume is attached to
- With
Selector string - With
Statuses List<string>
- Delete
Protection bool - (bool) Whether delete protection is enabled.
- Id int
- (int) Unique ID of the volume.
- Labels map[string]string
- (map) User-defined labels (key-value pairs).
- Linux
Device string - (string) Device path on the file system for the Volume.
- Name string
- (string) Name of the volume.
- Size int
- (int) Size of the volume.
- Location string
- (string) The location name. See the Hetzner Docs for more details about locations.
- Selector string
- Server
Id int - (Optional, int) Server ID the volume is attached to
- With
Selector string - With
Statuses []string
- delete
Protection Boolean - (bool) Whether delete protection is enabled.
- id Integer
- (int) Unique ID of the volume.
- labels Map<String,String>
- (map) User-defined labels (key-value pairs).
- linux
Device String - (string) Device path on the file system for the Volume.
- name String
- (string) Name of the volume.
- size Integer
- (int) Size of the volume.
- location String
- (string) The location name. See the Hetzner Docs for more details about locations.
- selector String
- server
Id Integer - (Optional, int) Server ID the volume is attached to
- with
Selector String - with
Statuses List<String>
- delete
Protection boolean - (bool) Whether delete protection is enabled.
- id number
- (int) Unique ID of the volume.
- labels {[key: string]: string}
- (map) User-defined labels (key-value pairs).
- linux
Device string - (string) Device path on the file system for the Volume.
- name string
- (string) Name of the volume.
- size number
- (int) Size of the volume.
- location string
- (string) The location name. See the Hetzner Docs for more details about locations.
- selector string
- server
Id number - (Optional, int) Server ID the volume is attached to
- with
Selector string - with
Statuses string[]
- delete_
protection bool - (bool) Whether delete protection is enabled.
- id int
- (int) Unique ID of the volume.
- labels Mapping[str, str]
- (map) User-defined labels (key-value pairs).
- linux_
device str - (string) Device path on the file system for the Volume.
- name str
- (string) Name of the volume.
- size int
- (int) Size of the volume.
- location str
- (string) The location name. See the Hetzner Docs for more details about locations.
- selector str
- server_
id int - (Optional, int) Server ID the volume is attached to
- with_
selector str - with_
statuses Sequence[str]
- delete
Protection Boolean - (bool) Whether delete protection is enabled.
- id Number
- (int) Unique ID of the volume.
- labels Map<String>
- (map) User-defined labels (key-value pairs).
- linux
Device String - (string) Device path on the file system for the Volume.
- name String
- (string) Name of the volume.
- size Number
- (int) Size of the volume.
- location String
- (string) The location name. See the Hetzner Docs for more details about locations.
- selector String
- server
Id Number - (Optional, int) Server ID the volume is attached to
- with
Selector String - with
Statuses List<String>
Package Details
- Repository
- Hetzner Cloud pulumi/pulumi-hcloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
hcloudTerraform Provider.
Viewing docs for Hetzner Cloud v1.32.1
published on Tuesday, Feb 17, 2026 by Pulumi
published on Tuesday, Feb 17, 2026 by Pulumi
