Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as hcloud from "@pulumi/hcloud";
const main = new hcloud.StorageBox("main", {});
const backup = new hcloud.StorageBoxSnapshot("backup", {
storageBoxId: main.id,
description: "Before Tool XYZ Migration",
labels: {
env: "production",
},
});
import pulumi
import pulumi_hcloud as hcloud
main = hcloud.StorageBox("main")
backup = hcloud.StorageBoxSnapshot("backup",
storage_box_id=main.id,
description="Before Tool XYZ Migration",
labels={
"env": "production",
})
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 {
main, err := hcloud.NewStorageBox(ctx, "main", nil)
if err != nil {
return err
}
_, err = hcloud.NewStorageBoxSnapshot(ctx, "backup", &hcloud.StorageBoxSnapshotArgs{
StorageBoxId: main.ID(),
Description: pulumi.String("Before Tool XYZ Migration"),
Labels: pulumi.StringMap{
"env": pulumi.String("production"),
},
})
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 main = new HCloud.StorageBox("main");
var backup = new HCloud.StorageBoxSnapshot("backup", new()
{
StorageBoxId = main.Id,
Description = "Before Tool XYZ Migration",
Labels =
{
{ "env", "production" },
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.hcloud.StorageBox;
import com.pulumi.hcloud.StorageBoxSnapshot;
import com.pulumi.hcloud.StorageBoxSnapshotArgs;
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) {
var main = new StorageBox("main");
var backup = new StorageBoxSnapshot("backup", StorageBoxSnapshotArgs.builder()
.storageBoxId(main.id())
.description("Before Tool XYZ Migration")
.labels(Map.of("env", "production"))
.build());
}
}
resources:
main:
type: hcloud:StorageBox
backup:
type: hcloud:StorageBoxSnapshot
properties:
storageBoxId: ${main.id}
description: Before Tool XYZ Migration
labels:
env: production
Create StorageBoxSnapshot Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new StorageBoxSnapshot(name: string, args: StorageBoxSnapshotArgs, opts?: CustomResourceOptions);@overload
def StorageBoxSnapshot(resource_name: str,
args: StorageBoxSnapshotArgs,
opts: Optional[ResourceOptions] = None)
@overload
def StorageBoxSnapshot(resource_name: str,
opts: Optional[ResourceOptions] = None,
storage_box_id: Optional[int] = None,
description: Optional[str] = None,
labels: Optional[Mapping[str, str]] = None)func NewStorageBoxSnapshot(ctx *Context, name string, args StorageBoxSnapshotArgs, opts ...ResourceOption) (*StorageBoxSnapshot, error)public StorageBoxSnapshot(string name, StorageBoxSnapshotArgs args, CustomResourceOptions? opts = null)
public StorageBoxSnapshot(String name, StorageBoxSnapshotArgs args)
public StorageBoxSnapshot(String name, StorageBoxSnapshotArgs args, CustomResourceOptions options)
type: hcloud:StorageBoxSnapshot
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args StorageBoxSnapshotArgs
- 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 StorageBoxSnapshotArgs
- 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 StorageBoxSnapshotArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args StorageBoxSnapshotArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args StorageBoxSnapshotArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var storageBoxSnapshotResource = new HCloud.StorageBoxSnapshot("storageBoxSnapshotResource", new()
{
StorageBoxId = 0,
Description = "string",
Labels =
{
{ "string", "string" },
},
});
example, err := hcloud.NewStorageBoxSnapshot(ctx, "storageBoxSnapshotResource", &hcloud.StorageBoxSnapshotArgs{
StorageBoxId: pulumi.Int(0),
Description: pulumi.String("string"),
Labels: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var storageBoxSnapshotResource = new StorageBoxSnapshot("storageBoxSnapshotResource", StorageBoxSnapshotArgs.builder()
.storageBoxId(0)
.description("string")
.labels(Map.of("string", "string"))
.build());
storage_box_snapshot_resource = hcloud.StorageBoxSnapshot("storageBoxSnapshotResource",
storage_box_id=0,
description="string",
labels={
"string": "string",
})
const storageBoxSnapshotResource = new hcloud.StorageBoxSnapshot("storageBoxSnapshotResource", {
storageBoxId: 0,
description: "string",
labels: {
string: "string",
},
});
type: hcloud:StorageBoxSnapshot
properties:
description: string
labels:
string: string
storageBoxId: 0
StorageBoxSnapshot Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The StorageBoxSnapshot resource accepts the following input properties:
- Storage
Box intId - ID of the Storage Box.
- Description string
- Description of the Storage Box Snapshot.
- Labels Dictionary<string, string>
- User-defined labels (key-value pairs) for the resource.
- Storage
Box intId - ID of the Storage Box.
- Description string
- Description of the Storage Box Snapshot.
- Labels map[string]string
- User-defined labels (key-value pairs) for the resource.
- storage
Box IntegerId - ID of the Storage Box.
- description String
- Description of the Storage Box Snapshot.
- labels Map<String,String>
- User-defined labels (key-value pairs) for the resource.
- storage
Box numberId - ID of the Storage Box.
- description string
- Description of the Storage Box Snapshot.
- labels {[key: string]: string}
- User-defined labels (key-value pairs) for the resource.
- storage_
box_ intid - ID of the Storage Box.
- description str
- Description of the Storage Box Snapshot.
- labels Mapping[str, str]
- User-defined labels (key-value pairs) for the resource.
- storage
Box NumberId - ID of the Storage Box.
- description String
- Description of the Storage Box Snapshot.
- labels Map<String>
- User-defined labels (key-value pairs) for the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the StorageBoxSnapshot resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Is
Automatic bool - Whether the Storage Box Snapshot was created automatically.
- Name string
- Name of the Storage Box Snapshot.
- Id string
- The provider-assigned unique ID for this managed resource.
- Is
Automatic bool - Whether the Storage Box Snapshot was created automatically.
- Name string
- Name of the Storage Box Snapshot.
- id String
- The provider-assigned unique ID for this managed resource.
- is
Automatic Boolean - Whether the Storage Box Snapshot was created automatically.
- name String
- Name of the Storage Box Snapshot.
- id string
- The provider-assigned unique ID for this managed resource.
- is
Automatic boolean - Whether the Storage Box Snapshot was created automatically.
- name string
- Name of the Storage Box Snapshot.
- id str
- The provider-assigned unique ID for this managed resource.
- is_
automatic bool - Whether the Storage Box Snapshot was created automatically.
- name str
- Name of the Storage Box Snapshot.
- id String
- The provider-assigned unique ID for this managed resource.
- is
Automatic Boolean - Whether the Storage Box Snapshot was created automatically.
- name String
- Name of the Storage Box Snapshot.
Look up Existing StorageBoxSnapshot Resource
Get an existing StorageBoxSnapshot 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?: StorageBoxSnapshotState, opts?: CustomResourceOptions): StorageBoxSnapshot@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
is_automatic: Optional[bool] = None,
labels: Optional[Mapping[str, str]] = None,
name: Optional[str] = None,
storage_box_id: Optional[int] = None) -> StorageBoxSnapshotfunc GetStorageBoxSnapshot(ctx *Context, name string, id IDInput, state *StorageBoxSnapshotState, opts ...ResourceOption) (*StorageBoxSnapshot, error)public static StorageBoxSnapshot Get(string name, Input<string> id, StorageBoxSnapshotState? state, CustomResourceOptions? opts = null)public static StorageBoxSnapshot get(String name, Output<String> id, StorageBoxSnapshotState state, CustomResourceOptions options)resources: _: type: hcloud:StorageBoxSnapshot get: id: ${id}- 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.
- Description string
- Description of the Storage Box Snapshot.
- Is
Automatic bool - Whether the Storage Box Snapshot was created automatically.
- Labels Dictionary<string, string>
- User-defined labels (key-value pairs) for the resource.
- Name string
- Name of the Storage Box Snapshot.
- Storage
Box intId - ID of the Storage Box.
- Description string
- Description of the Storage Box Snapshot.
- Is
Automatic bool - Whether the Storage Box Snapshot was created automatically.
- Labels map[string]string
- User-defined labels (key-value pairs) for the resource.
- Name string
- Name of the Storage Box Snapshot.
- Storage
Box intId - ID of the Storage Box.
- description String
- Description of the Storage Box Snapshot.
- is
Automatic Boolean - Whether the Storage Box Snapshot was created automatically.
- labels Map<String,String>
- User-defined labels (key-value pairs) for the resource.
- name String
- Name of the Storage Box Snapshot.
- storage
Box IntegerId - ID of the Storage Box.
- description string
- Description of the Storage Box Snapshot.
- is
Automatic boolean - Whether the Storage Box Snapshot was created automatically.
- labels {[key: string]: string}
- User-defined labels (key-value pairs) for the resource.
- name string
- Name of the Storage Box Snapshot.
- storage
Box numberId - ID of the Storage Box.
- description str
- Description of the Storage Box Snapshot.
- is_
automatic bool - Whether the Storage Box Snapshot was created automatically.
- labels Mapping[str, str]
- User-defined labels (key-value pairs) for the resource.
- name str
- Name of the Storage Box Snapshot.
- storage_
box_ intid - ID of the Storage Box.
- description String
- Description of the Storage Box Snapshot.
- is
Automatic Boolean - Whether the Storage Box Snapshot was created automatically.
- labels Map<String>
- User-defined labels (key-value pairs) for the resource.
- name String
- Name of the Storage Box Snapshot.
- storage
Box NumberId - ID of the Storage Box.
Import
In Terraform v1.5.0 and later, the import block can be used with the id attribute, for example:
terraform
import {
to = hcloud_storage_box_snapshot.example
id = “$STORAGE_BOX_ID/$STORAGE_BOX_SNAPSHOT_ID”
}
The pulumi import command can be used, for example:
$ pulumi import hcloud:index/storageBoxSnapshot:StorageBoxSnapshot example "$STORAGE_BOX_ID/$STORAGE_BOX_SNAPSHOT_ID"
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Hetzner Cloud pulumi/pulumi-hcloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
hcloudTerraform Provider.
