Terraform module to provision Volume
and Volume Attachment
resources in Hetzner Cloud.
# Configure the Hetzner Cloud Provider
provider "hcloud" {
token = var.hcloud_token
}
module "sv" {
source = "zoro16/server/hcloud"
version = "1.0.0"
create_server = true
server_name = "sample-server"
server_type = "cax11"
location = "fsn1"
backups = true
image = "debian-12"
placement_group_name = "placement-group-sample"
public_net_ipv4_enabled = true
public_net_ipv6_enabled = true
}
module "vol" {
source = "../../"
create_volume = true
volume_size = 10
volume_name = "example-vol1"
volume_automount = false
volume_format = "xfs"
volume_server_id = module.sv.server_id
# volume_location = "fsn1"
}
Name | Version |
---|---|
terraform | >= 1.2.0 |
hcloud | >= 1.42.1 |
Name | Version |
---|---|
hcloud | >= 1.42.1 |
No modules.
Name | Type |
---|---|
hcloud_volume.vol | resource |
hcloud_volume_attachment.vol_attach | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
create_volume | A boolean to check whether to create a Volume or not. | bool |
false |
no |
create_volume_attachment | A boolean to check whether to create a Volume Attachment or not. | bool |
false |
no |
volume_attachment_automount | Automount the volume upon attaching it. | bool |
false |
no |
volume_attachment_server_id | Server to attach the Volume to. | number |
null |
no |
volume_attachment_volume_id | ID of the Volume. | number |
null |
no |
volume_automount | Automount the volume upon attaching it (server_id must be provided). | bool |
true |
no |
volume_delete_protection | Enable or disable delete protection. | bool |
false |
no |
volume_format | Format volume after creation. xfs or ext4 |
string |
"xfs" |
no |
volume_location | The location name of the volume to create, not allowed if server_id argument is passed. |
string |
null |
no |
volume_name | Name of the Volume to be created. | string |
"" |
no |
volume_server_id | Server to attach the Volume to, not allowed if location argument is passed. | number |
null |
no |
volume_size | Size of the Volume to be created in GB. | number |
10 |
no |
Name | Description |
---|---|
volume_attachment_id | Unique ID of the Volume Attachment. |
volume_attachment_server_id | Server to attach the Volume to. |
volume_attachment_volume_id | ID of the Volume. |
volume_delete_protection | Enable or disable delete protection. |
volume_format | Format volume after creation. xfs or ext4 . |
volume_id | Unique ID of the volume. |
volume_labels | User-defined labels (key-value pairs). |
volume_linux_device | Device path on the file system for the Volume. |
volume_location | The location name of the volume to create, not allowed if server_id argument is passed. |
volume_name | Name of the Volume to be created. |
volume_server_id | Server to attach the Volume to, not allowed if location argument is passed. |
volume_size | Size of the Volume to be created in GB. |