From 9160301ab3027da53b20f4b976861c783ccc94c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Sun, 22 Mar 2026 22:54:07 +0100 Subject: [PATCH] Add DNS records via Terraform, bump hcloud to v1.60 (#4) - trails.cool and planner.trails.cool A records pointing to server - Using hcloud_zone_rrset (native hcloud provider, no separate DNS provider) - Bumped hcloud provider ~> 1.45 to ~> 1.60 - Server type updated to cx23 Co-authored-by: Claude Opus 4.6 (1M context) --- infrastructure/terraform/main.tf | 32 +++++++++++++++++++++++++-- infrastructure/terraform/variables.tf | 2 +- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/infrastructure/terraform/main.tf b/infrastructure/terraform/main.tf index 6d1688f..08a8264 100644 --- a/infrastructure/terraform/main.tf +++ b/infrastructure/terraform/main.tf @@ -4,7 +4,7 @@ terraform { required_providers { hcloud = { source = "hetznercloud/hcloud" - version = "~> 1.45" + version = "~> 1.60" } } } @@ -20,7 +20,7 @@ resource "hcloud_ssh_key" "deploy" { resource "hcloud_server" "trails" { name = "trails-cool" - server_type = "cx22" + server_type = "cx23" image = "ubuntu-24.04" location = "fsn1" ssh_keys = [hcloud_ssh_key.deploy.id] @@ -74,6 +74,34 @@ resource "hcloud_firewall_attachment" "trails" { server_ids = [hcloud_server.trails.id] } +# DNS + +resource "hcloud_zone_rrset" "root_a" { + zone = "trails.cool" + name = "@" + type = "A" + ttl = 300 + records = [{ value = hcloud_server.trails.ipv4_address }] +} + +resource "hcloud_zone_rrset" "planner_a" { + zone = "trails.cool" + name = "planner" + type = "A" + ttl = 300 + records = [{ value = hcloud_server.trails.ipv4_address }] +} + +# Outputs + output "server_ip" { value = hcloud_server.trails.ipv4_address } + +output "domain" { + value = "trails.cool" +} + +output "planner_domain" { + value = "planner.trails.cool" +} diff --git a/infrastructure/terraform/variables.tf b/infrastructure/terraform/variables.tf index 05ff561..a3002c2 100644 --- a/infrastructure/terraform/variables.tf +++ b/infrastructure/terraform/variables.tf @@ -7,4 +7,4 @@ variable "hcloud_token" { variable "ssh_public_key" { description = "SSH public key for server access" type = string -} +} \ No newline at end of file