Skip to content

Repository files navigation

terraform-hcloud-volume

Terraform module to manage the following Hetzner Cloud resources:

  • hcloud_volume

Usage

Copy and paste the following code snippet to your Terraform configuration, specify the required variables and run the command terraform init.

module "hcloud_server" {
  source  = "gitlab.com/terraform-child-modules-48151/terraform-hcloud-server/local"
  version = "1.1.0"

  name        = "example-server"
  image       = "debian-13"
  server_type = "cx22"

  location = "nbg1"
}

module "hcloud_volume" {
  source  = "gitlab.com/terraform-child-modules-48151/terraform-hcloud-volume/local"
  version = "1.0.0"

  name = "volume-1"
  size = 10

  server_id = module.hcloud_server.id
  automount = true
}

Requirements

Name Version
terraform >= 1.0
hcloud ~> 1.0

Providers

Name Version
hcloud ~> 1.0

Modules

No modules.

Resources

Name Type
hcloud_volume.this resource

Inputs

Name Description Type Default Required
automount Automount the volume upon attaching it (server_id must be provided) bool false no
delete_protection Enable or disable delete protection bool false no
format Format volume after creation string "ext4" no
labels User-defined labels (key-value pairs) map(string) {} no
location The location name of the volume to create, not allowed if server_id argument is passed string null no
name Name of the volume to create string n/a yes
server_id Server to attach the Volume to, not allowed if location argument is passed number null no
size Size of the volume (in GB) number n/a yes

Outputs

Name Description
delete_protection Whether delete protection is enabled
id Unique ID of the volume
labels User-defined labels (key-value pairs)
linux_device Device path on the file system for the Volume
location The location name
name Name of the volume
server_id Server ID the volume is attached to
size Size of the volume

Authors

Created and maintained by Dennis Hoppe.

License

Apache 2 licensed. See LICENSE for full details.