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) <noreply@anthropic.com>
This commit is contained in:
Ullrich Schäfer 2026-03-22 22:54:07 +01:00 committed by GitHub
parent cd18436187
commit 9160301ab3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 31 additions and 3 deletions

View file

@ -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"
}

View file

@ -7,4 +7,4 @@ variable "hcloud_token" {
variable "ssh_public_key" {
description = "SSH public key for server access"
type = string
}
}