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