Skip to content

Commit 25e8d64

Browse files
committed
refactor(cloud-iac): rename control-plane VM eliza-cp-<env>-<n> → eliza-<n>
The shorter prefix matches the data-plane convention (eliza-core-<hex>) and supports the in-place rename of the legacy prod VM (milady → eliza-1) via Hetzner's PUT /servers/{id}. Environment moves to a label (`environment = production|staging`) so the Hetzner Console can filter without bloating every SSH command. Also drops the inline import walkthrough from the README — it's a one-shot adoption op that lives in operator scratch space, not in repo docs that drift over time.
1 parent 7aa324f commit 25e8d64

4 files changed

Lines changed: 21 additions & 25 deletions

File tree

packages/cloud-infra/cloud/terraform/hetzner/ARCHITECTURE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ split so we stop treating manually-created VMs as "infrastructure-by-prayer".
99
┌──────────────────────────────────────────────────────────────┐
1010
│ Tier 1 — Control plane (static, 1-2 VMs, Terraform) │
1111
│ │
12-
│ eliza-cp-production-1 (Hetzner cpx21, fsn1) │
12+
│ eliza-1 (Hetzner cpx21, fsn1) │
1313
│ ├── eliza-provisioning-worker (systemd, queue consumer)│
1414
│ ├── eliza-agent-router (systemd, HTTP routing) │
1515
│ ├── headscale (VPN mesh) │
@@ -64,7 +64,7 @@ to coordinate it.
6464

6565
| Layer | Prefix | Example | Where it's set |
6666
|---|---|---|---|
67-
| Control plane VM | `eliza-cp-<env>-<n>` | `eliza-cp-production-1` | Terraform `var.environment` |
67+
| Control plane VM | `eliza-<n>` | `eliza-1` | Terraform `hcloud_server.control_plane` |
6868
| Data plane node (NEW) | `eliza-core-<hex>` | `eliza-core-38ea87b1` | [`generateNodeId()`](../../../../cloud-shared/src/lib/services/containers/node-autoscaler.ts) |
6969
| Data plane node (LEGACY) | `milady-core-<n>` | `milady-core-1` | DEPRECATED — see [Legacy migration](#legacy-milady-core-migration) |
7070

packages/cloud-infra/cloud/terraform/hetzner/control-plane/README.md

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,15 @@ scp packages/cloud-shared/.env.local root@<vm-ip>:/opt/eliza/cloud/.env.local
5353

5454
## Adopt the existing production VM into Terraform
5555

56-
The current prod manager VM (`89.167.63.246`, hostname `milady`) was
57-
created by-hand via `packages/scripts/cloud/admin/bootstrap-provisioning-worker-host.mjs`
58-
on May 7th. To bring it under Terraform without recreating it:
59-
60-
```bash
61-
# 1. Look up the Hetzner Cloud server ID:
62-
hcloud server list # find the one with IP 89.167.63.246
63-
64-
# 2. Import the existing resource into state:
65-
terraform init -backend-config=backend-production.hcl
66-
terraform import \
67-
-var-file=tfvars/production.tfvars \
68-
'hcloud_server.control_plane["1"]' \
69-
<SERVER_ID>
70-
71-
# 3. Run `terraform plan` and adjust variables until the diff is empty.
72-
# Common drift: labels, ssh_keys (manually added during initial setup).
73-
```
56+
The current prod manager VM (`89.167.63.246`, historical hostname
57+
`milady`) was created by hand in May 2026. To bring it under Terraform
58+
without recreating it, look up the Hetzner Cloud server ID
59+
(`hcloud server list`), then `terraform import 'hcloud_server.control_plane["1"]' <id>`
60+
plus a `terraform import` for each existing `hcloud_ssh_key`. The first
61+
plan after import shows the in-place rename `milady → eliza-1`, the new
62+
labels, and the Cloudflare DNS record creation; `user_data` and `image`
63+
diffs are suppressed by `lifecycle { ignore_changes }`. One-shot — never
64+
re-run.
7465

7566
## What this module does NOT manage (yet)
7667

packages/cloud-infra/cloud/terraform/hetzner/control-plane/main.tf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,20 @@ resource "hcloud_ssh_key" "operators" {
1515
# inserted/reordered in `var.ssh_public_keys`.
1616
for_each = { for key in var.ssh_public_keys : substr(sha256(key), 0, 12) => key }
1717

18-
name = "eliza-cp-${var.environment}-op-${each.key}"
18+
name = "eliza-op-${var.environment}-${each.key}"
1919
public_key = each.value
2020
labels = local.common_labels
2121
}
2222

2323
resource "hcloud_server" "control_plane" {
2424
for_each = toset([for i in range(var.control_plane_count) : tostring(i + 1)])
2525

26-
name = "eliza-cp-${var.environment}-${each.value}"
26+
# Naming: `eliza-${index}` — short, matches the data-plane convention
27+
# `eliza-core-<hex>` and supports the in-place rename from the legacy
28+
# `milady` VM. The environment lives in labels, not the hostname, so the
29+
# prod/staging distinction shows up in the Hetzner Console filter
30+
# without bloating the hostname every operator types into SSH.
31+
name = "eliza-${each.value}"
2732
location = var.hcloud_location
2833
server_type = var.hcloud_server_type
2934
image = var.hcloud_image
@@ -33,7 +38,7 @@ resource "hcloud_server" "control_plane" {
3338
})
3439

3540
user_data = templatefile("${path.module}/cloud-init/bootstrap.yaml.tftpl", {
36-
hostname = "eliza-cp-${var.environment}-${each.value}"
41+
hostname = "eliza-${each.value}"
3742
deploy_branch = var.deploy_branch
3843
operator_ssh_keys = var.ssh_public_keys
3944
})

packages/cloud-infra/cloud/terraform/hetzner/control-plane/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ variable "cloudflare_zone_id" {
4747
}
4848

4949
variable "control_plane_hostname_prefix" {
50-
description = "DNS subdomain prefix. Final record: <prefix>-<environment>-<n>.elizacloud.ai"
50+
description = "DNS subdomain prefix. Final record: <prefix>-<environment>-<n>.elizacloud.ai (e.g. eliza-production-1.elizacloud.ai)"
5151
type = string
52-
default = "cp"
52+
default = "eliza"
5353
}
5454

5555
variable "deploy_branch" {

0 commit comments

Comments
 (0)