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
        {
            Automount = true,
            ServerId = node1.Id,
            Size = 50,
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-hcloud/sdk/go/hcloud"
    "github.com/pulumi/pulumi/sdk/v2/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{
            Automount: pulumi.Bool(true),
            ServerId:  node1.ID(),
            Size:      pulumi.Int(50),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_hcloud as hcloud

node1 = hcloud.Server("node1",
    image="debian-9",
    server_type="cx11")
master = hcloud.Volume("master",
    automount=True,
    server_id=node1.id,
    size=50)
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", {
    automount: true,
    serverId: node1.id.apply(id => Number.parseFloat(id)),
    size: 50,
});

Create a Volume Resource

new Volume(name: string, args: VolumeArgs, opts?: CustomResourceOptions);
def Volume(resource_name, opts=None, automount=None, format=None, labels=None, location=None, name=None, server_id=None, size=None, __props__=None);
func NewVolume(ctx *Context, name string, args VolumeArgs, opts ...ResourceOption) (*Volume, error)
public Volume(string name, VolumeArgs args, CustomResourceOptions? opts = null)
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.
opts ResourceOptions
A bag of options that control this 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.

Volume Resource Properties

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

Inputs

The Volume resource accepts the following input properties:

Size int
Automount bool
Format string
Labels Dictionary<string, object>
Location string
Name string
ServerId int
Size int
Automount bool
Format string
Labels map[string]interface{}
Location string
Name string
ServerId int
size number
automount boolean
format string
labels {[key: string]: any}
location string
name string
serverId number
size float
automount bool
format str
labels Dict[str, Any]
location str
name str
server_id float

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
Id string
The provider-assigned unique ID for this managed resource.
LinuxDevice string
id string
The provider-assigned unique ID for this managed resource.
linuxDevice string
id str
The provider-assigned unique ID for this managed resource.
linux_device str

Look up an 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
static get(resource_name, id, opts=None, automount=None, format=None, labels=None, linux_device=None, location=None, name=None, server_id=None, size=None, __props__=None);
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)
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.

The following state arguments are supported:

Automount bool
Format string
Labels Dictionary<string, object>
LinuxDevice string
Location string
Name string
ServerId int
Size int
Automount bool
Format string
Labels map[string]interface{}
LinuxDevice string
Location string
Name string
ServerId int
Size int
automount boolean
format string
labels {[key: string]: any}
linuxDevice string
location string
name string
serverId number
size number
automount bool
format str
labels Dict[str, Any]
linux_device str
location str
name str
server_id float
size float

Package Details

Repository
https://github.com/pulumi/pulumi-hcloud
License
Apache-2.0
Notes
This Pulumi package is based on the hcloud Terraform Provider.