Snapshot

Provides a Hetzner Cloud snapshot to represent a image with type snapshot in the Hetzner Cloud. This resource makes it easy to create

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 my_snapshot = new HCloud.Snapshot("my-snapshot", new HCloud.SnapshotArgs
        {
            ServerId = node1.Id,
        });
    }

}
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.NewSnapshot(ctx, "my_snapshot", &hcloud.SnapshotArgs{
			ServerId: node1.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_hcloud as hcloud

node1 = hcloud.Server("node1",
    image="debian-9",
    server_type="cx11")
my_snapshot = hcloud.Snapshot("my-snapshot", server_id=node1.id)
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";

const node1 = new hcloud.Server("node1", {
    image: "debian-9",
    serverType: "cx11",
});
const my_snapshot = new hcloud.Snapshot("my-snapshot", {serverId: node1.id});

Create a Snapshot Resource

new Snapshot(name: string, args: SnapshotArgs, opts?: CustomResourceOptions);
@overload
def Snapshot(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             description: Optional[str] = None,
             labels: Optional[Mapping[str, Any]] = None,
             server_id: Optional[int] = None)
@overload
def Snapshot(resource_name: str,
             args: SnapshotArgs,
             opts: Optional[ResourceOptions] = None)
func NewSnapshot(ctx *Context, name string, args SnapshotArgs, opts ...ResourceOption) (*Snapshot, error)
public Snapshot(string name, SnapshotArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args SnapshotArgs
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 SnapshotArgs
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 SnapshotArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args SnapshotArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Snapshot Resource Properties

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

Inputs

The Snapshot resource accepts the following input properties:

ServerId int
Server to the snapshot should be created from.
Description string
Description of the Floating IP.
Labels Dictionary<string, object>
User-defined labels (key-value pairs) should be created with.
ServerId int
Server to the snapshot should be created from.
Description string
Description of the Floating IP.
Labels map[string]interface{}
User-defined labels (key-value pairs) should be created with.
serverId number
Server to the snapshot should be created from.
description string
Description of the Floating IP.
labels {[key: string]: any}
User-defined labels (key-value pairs) should be created with.
server_id int
Server to the snapshot should be created from.
description str
Description of the Floating IP.
labels Mapping[str, Any]
User-defined labels (key-value pairs) should be created with.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing Snapshot Resource

Get an existing Snapshot 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?: SnapshotState, opts?: CustomResourceOptions): Snapshot
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        labels: Optional[Mapping[str, Any]] = None,
        server_id: Optional[int] = None) -> Snapshot
func GetSnapshot(ctx *Context, name string, id IDInput, state *SnapshotState, opts ...ResourceOption) (*Snapshot, error)
public static Snapshot Get(string name, Input<string> id, SnapshotState? 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:

Description string
Description of the Floating IP.
Labels Dictionary<string, object>
User-defined labels (key-value pairs) should be created with.
ServerId int
Server to the snapshot should be created from.
Description string
Description of the Floating IP.
Labels map[string]interface{}
User-defined labels (key-value pairs) should be created with.
ServerId int
Server to the snapshot should be created from.
description string
Description of the Floating IP.
labels {[key: string]: any}
User-defined labels (key-value pairs) should be created with.
serverId number
Server to the snapshot should be created from.
description str
Description of the Floating IP.
labels Mapping[str, Any]
User-defined labels (key-value pairs) should be created with.
server_id int
Server to the snapshot should be created from.

Import

Snapshots can be imported using its image id

 $ pulumi import hcloud:index/snapshot:Snapshot myip <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.