Hetzner Cloud

v1.10.1 published on Wednesday, Aug 3, 2022 by Pulumi

Volume

Provides a Hetzner Cloud volume resource to manage volumes.

Example Usage

using Pulumi;
using HCloud = Pulumi.HCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var node1 = new HCloud.Server("node1", new HCloud.ServerArgs
        {
            Image = "debian-9",
            ServerType = "cx11",
        });
        var master = new HCloud.Volume("master", new HCloud.VolumeArgs
        {
            Size = 50,
            ServerId = node1.Id,
            Automount = true,
            Format = "ext4",
        });
    }

}
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 {
		node1, err := hcloud.NewServer(ctx, "node1", &hcloud.ServerArgs{
			Image:      pulumi.String("debian-9"),
			ServerType: pulumi.String("cx11"),
		})
		if err != nil {
			return err
		}
		_, err = hcloud.NewVolume(ctx, "master", &hcloud.VolumeArgs{
			Size:      pulumi.Int(50),
			ServerId:  node1.ID(),
			Automount: pulumi.Bool(true),
			Format:    pulumi.String("ext4"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var node1 = new Server("node1", ServerArgs.builder()        
            .image("debian-9")
            .serverType("cx11")
            .build());

        var master = new Volume("master", VolumeArgs.builder()        
            .size(50)
            .serverId(node1.id())
            .automount(true)
            .format("ext4")
            .build());

    }
}
import pulumi
import pulumi_hcloud as hcloud

node1 = hcloud.Server("node1",
    image="debian-9",
    server_type="cx11")
master = hcloud.Volume("master",
    size=50,
    server_id=node1.id,
    automount=True,
    format="ext4")
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const node1 = new hcloud.Server("node1", {
    image: "debian-9",
    serverType: "cx11",
});
const master = new hcloud.Volume("master", {
    size: 50,
    serverId: node1.id,
    automount: true,
    format: "ext4",
});
resources:
  node1:
    type: hcloud:Server
    properties:
      image: debian-9
      serverType: cx11
  master:
    type: hcloud:Volume
    properties:
      size: 50
      serverId: ${node1.id}
      automount: true
      format: ext4

Create Volume Resource

new Volume(name: string, args: VolumeArgs, opts?: CustomResourceOptions);
@overload
def Volume(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           automount: Optional[bool] = None,
           delete_protection: Optional[bool] = None,
           format: Optional[str] = None,
           labels: Optional[Mapping[str, Any]] = None,
           location: Optional[str] = None,
           name: Optional[str] = None,
           server_id: Optional[int] = None,
           size: Optional[int] = None)
@overload
def Volume(resource_name: str,
           args: VolumeArgs,
           opts: Optional[ResourceOptions] = None)
func NewVolume(ctx *Context, name string, args VolumeArgs, opts ...ResourceOption) (*Volume, error)
public Volume(string name, VolumeArgs args, CustomResourceOptions? opts = null)
public Volume(String name, VolumeArgs args)
public Volume(String name, VolumeArgs args, CustomResourceOptions options)
type: hcloud:Volume
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args VolumeArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args VolumeArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args VolumeArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args VolumeArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args VolumeArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Volume Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Volume resource accepts the following input properties:

Size int

Size of the volume (in GB).

Automount bool

Automount the volume upon attaching it (server_id must be provided).

DeleteProtection bool

Enable or disable delete protection.

Format string

Format volume after creation. xfs or ext4

Labels Dictionary<string, object>

(map) User-defined labels (key-value pairs).

Location string

Location of the volume to create, not allowed if server_id argument is passed.

Name string

Name of the volume to create (must be unique per project).

ServerId int

Server to attach the Volume to, not allowed if location argument is passed.

Size int

Size of the volume (in GB).

Automount bool

Automount the volume upon attaching it (server_id must be provided).

DeleteProtection bool

Enable or disable delete protection.

Format string

Format volume after creation. xfs or ext4

Labels map[string]interface{}

(map) User-defined labels (key-value pairs).

Location string

Location of the volume to create, not allowed if server_id argument is passed.

Name string

Name of the volume to create (must be unique per project).

ServerId int

Server to attach the Volume to, not allowed if location argument is passed.

size Integer

Size of the volume (in GB).

automount Boolean

Automount the volume upon attaching it (server_id must be provided).

deleteProtection Boolean

Enable or disable delete protection.

format String

Format volume after creation. xfs or ext4

labels Map<String,Object>

(map) User-defined labels (key-value pairs).

location String

Location of the volume to create, not allowed if server_id argument is passed.

name String

Name of the volume to create (must be unique per project).

serverId Integer

Server to attach the Volume to, not allowed if location argument is passed.

size number

Size of the volume (in GB).

automount boolean

Automount the volume upon attaching it (server_id must be provided).

deleteProtection boolean

Enable or disable delete protection.

format string

Format volume after creation. xfs or ext4

labels {[key: string]: any}

(map) User-defined labels (key-value pairs).

location string

Location of the volume to create, not allowed if server_id argument is passed.

name string

Name of the volume to create (must be unique per project).

serverId number

Server to attach the Volume to, not allowed if location argument is passed.

size int

Size of the volume (in GB).

automount bool

Automount the volume upon attaching it (server_id must be provided).

delete_protection bool

Enable or disable delete protection.

format str

Format volume after creation. xfs or ext4

labels Mapping[str, Any]

(map) User-defined labels (key-value pairs).

location str

Location of the volume to create, not allowed if server_id argument is passed.

name str

Name of the volume to create (must be unique per project).

server_id int

Server to attach the Volume to, not allowed if location argument is passed.

size Number

Size of the volume (in GB).

automount Boolean

Automount the volume upon attaching it (server_id must be provided).

deleteProtection Boolean

Enable or disable delete protection.

format String

Format volume after creation. xfs or ext4

labels Map<Any>

(map) User-defined labels (key-value pairs).

location String

Location of the volume to create, not allowed if server_id argument is passed.

name String

Name of the volume to create (must be unique per project).

serverId Number

Server to attach the Volume to, not allowed if location argument is passed.

Outputs

All input properties are implicitly available as output properties. Additionally, the Volume resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

LinuxDevice string

(string) Device path on the file system for the Volume.

Id string

The provider-assigned unique ID for this managed resource.

LinuxDevice string

(string) Device path on the file system for the Volume.

id String

The provider-assigned unique ID for this managed resource.

linuxDevice String

(string) Device path on the file system for the Volume.

id string

The provider-assigned unique ID for this managed resource.

linuxDevice string

(string) Device path on the file system for the Volume.

id str

The provider-assigned unique ID for this managed resource.

linux_device str

(string) Device path on the file system for the Volume.

id String

The provider-assigned unique ID for this managed resource.

linuxDevice String

(string) Device path on the file system for the Volume.

Look up Existing Volume Resource

Get an existing Volume resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: VolumeState, opts?: CustomResourceOptions): Volume
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        automount: Optional[bool] = None,
        delete_protection: Optional[bool] = None,
        format: Optional[str] = None,
        labels: Optional[Mapping[str, Any]] = None,
        linux_device: Optional[str] = None,
        location: Optional[str] = None,
        name: Optional[str] = None,
        server_id: Optional[int] = None,
        size: Optional[int] = None) -> Volume
func GetVolume(ctx *Context, name string, id IDInput, state *VolumeState, opts ...ResourceOption) (*Volume, error)
public static Volume Get(string name, Input<string> id, VolumeState? state, CustomResourceOptions? opts = null)
public static Volume get(String name, Output<String> id, VolumeState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Automount bool

Automount the volume upon attaching it (server_id must be provided).

DeleteProtection bool

Enable or disable delete protection.

Format string

Format volume after creation. xfs or ext4

Labels Dictionary<string, object>

(map) User-defined labels (key-value pairs).

LinuxDevice string

(string) Device path on the file system for the Volume.

Location string

Location of the volume to create, not allowed if server_id argument is passed.

Name string

Name of the volume to create (must be unique per project).

ServerId int

Server to attach the Volume to, not allowed if location argument is passed.

Size int

Size of the volume (in GB).

Automount bool

Automount the volume upon attaching it (server_id must be provided).

DeleteProtection bool

Enable or disable delete protection.

Format string

Format volume after creation. xfs or ext4

Labels map[string]interface{}

(map) User-defined labels (key-value pairs).

LinuxDevice string

(string) Device path on the file system for the Volume.

Location string

Location of the volume to create, not allowed if server_id argument is passed.

Name string

Name of the volume to create (must be unique per project).

ServerId int

Server to attach the Volume to, not allowed if location argument is passed.

Size int

Size of the volume (in GB).

automount Boolean

Automount the volume upon attaching it (server_id must be provided).

deleteProtection Boolean

Enable or disable delete protection.

format String

Format volume after creation. xfs or ext4

labels Map<String,Object>

(map) User-defined labels (key-value pairs).

linuxDevice String

(string) Device path on the file system for the Volume.

location String

Location of the volume to create, not allowed if server_id argument is passed.

name String

Name of the volume to create (must be unique per project).

serverId Integer

Server to attach the Volume to, not allowed if location argument is passed.

size Integer

Size of the volume (in GB).

automount boolean

Automount the volume upon attaching it (server_id must be provided).

deleteProtection boolean

Enable or disable delete protection.

format string

Format volume after creation. xfs or ext4

labels {[key: string]: any}

(map) User-defined labels (key-value pairs).

linuxDevice string

(string) Device path on the file system for the Volume.

location string

Location of the volume to create, not allowed if server_id argument is passed.

name string

Name of the volume to create (must be unique per project).

serverId number

Server to attach the Volume to, not allowed if location argument is passed.

size number

Size of the volume (in GB).

automount bool

Automount the volume upon attaching it (server_id must be provided).

delete_protection bool

Enable or disable delete protection.

format str

Format volume after creation. xfs or ext4

labels Mapping[str, Any]

(map) User-defined labels (key-value pairs).

linux_device str

(string) Device path on the file system for the Volume.

location str

Location of the volume to create, not allowed if server_id argument is passed.

name str

Name of the volume to create (must be unique per project).

server_id int

Server to attach the Volume to, not allowed if location argument is passed.

size int

Size of the volume (in GB).

automount Boolean

Automount the volume upon attaching it (server_id must be provided).

deleteProtection Boolean

Enable or disable delete protection.

format String

Format volume after creation. xfs or ext4

labels Map<Any>

(map) User-defined labels (key-value pairs).

linuxDevice String

(string) Device path on the file system for the Volume.

location String

Location of the volume to create, not allowed if server_id argument is passed.

name String

Name of the volume to create (must be unique per project).

serverId Number

Server to attach the Volume to, not allowed if location argument is passed.

size Number

Size of the volume (in GB).

Import

Volumes can be imported using their id

 $ pulumi import hcloud:index/volume:Volume myvolume <id>

Package Details

Repository
https://github.com/pulumi/pulumi-hcloud
License
Apache-2.0
Notes

This Pulumi package is based on the hcloud Terraform Provider.