Skip to content

Commit 3295911

Browse files
DevelopmentCatsbrymut
authored andcommitted
fix(hetzner-linux): remove count from volume resource to prevent destruction.
1 parent a1f1493 commit 3295911

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

registry/brymut/templates/hetzner-linux/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ tags: [vm, linux, hetzner]
99

1010
Provision Hetzner Cloud servers as [Coder workspaces](https://coder.com/docs/workspaces) with this example template.
1111

12+
> [!IMPORTANT]
13+
> **Volume Management & Costs:** Hetzner Cloud volumes persist even when workspaces are stopped and will continue to incur storage costs (€0.0476/GB/month). Volumes are only automatically deleted when the workspace is completely deleted. Monitor your volumes in the [Hetzner Cloud Console](https://console.hetzner.cloud/) to manage costs effectively.
14+
1215
## Prerequisites
1316

1417
To deploy workspaces as Hetzner Cloud servers, you'll need:

registry/brymut/templates/hetzner-linux/main.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ resource "hcloud_server" "dev" {
7979
user_data = templatefile("cloud-config.yaml.tftpl", {
8080
username = lower(data.coder_workspace_owner.me.name)
8181
home_volume_label = "coder-${data.coder_workspace.me.id}-home"
82-
volume_id = hcloud_volume.home_volume[count.index].id
82+
volume_id = hcloud_volume.home_volume.id
8383
init_script = base64encode(coder_agent.main.init_script)
8484
coder_agent_token = coder_agent.main.token
8585
})
@@ -90,7 +90,6 @@ resource "hcloud_server" "dev" {
9090
}
9191

9292
resource "hcloud_volume" "home_volume" {
93-
count = data.coder_workspace.me.start_count
9493
name = "coder-${data.coder_workspace.me.id}-home"
9594
size = data.coder_parameter.home_volume_size.value
9695
location = data.coder_parameter.hcloud_location.value
@@ -102,7 +101,7 @@ resource "hcloud_volume" "home_volume" {
102101

103102
resource "hcloud_volume_attachment" "home_volume_attachment" {
104103
count = data.coder_workspace.me.start_count
105-
volume_id = hcloud_volume.home_volume[count.index].id
104+
volume_id = hcloud_volume.home_volume.id
106105
server_id = hcloud_server.dev[count.index].id
107106
automount = false
108107
}

0 commit comments

Comments
 (0)