Post-Tyranny-Tech-Infrastru.../tofu/dns.tf
Pieter 0135bd360a Implement OpenTofu infrastructure provisioning (#1)
Completed:
-  Hetzner Cloud provider configuration
-  VPS server provisioning with for_each pattern
-  Cloud firewall rules (SSH, HTTP, HTTPS)
-  SSH key management
-  Outputs for Ansible dynamic inventory
-  Variable structure and documentation
-  Test server successfully provisioned

Deferred:
- DNS configuration (commented out, waiting for domain)

Files added:
- tofu/versions.tf - Provider versions
- tofu/variables.tf - Input variable definitions
- tofu/main.tf - Core infrastructure resources
- tofu/dns.tf - DNS configuration (optional)
- tofu/outputs.tf - Outputs for Ansible integration
- tofu/terraform.tfvars.example - Configuration template
- tofu/README.md - Comprehensive setup guide

Closes #1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-27 13:48:42 +01:00

44 lines
1.2 KiB
HCL

# DNS Configuration
# OPTIONAL: Only used if you have a domain registered in Hetzner DNS
# Comment out this entire file if you don't have a domain yet
# Uncomment below when you have a domain registered in Hetzner DNS
/*
# DNS Zone (must already exist in Hetzner DNS)
data "hetznerdns_zone" "main" {
name = var.base_domain
}
# A Records for client servers
resource "hetznerdns_record" "client_a" {
for_each = var.clients
zone_id = data.hetznerdns_zone.main.id
name = each.value.subdomain
type = "A"
value = hcloud_server.client[each.key].ipv4_address
ttl = 300
}
# Wildcard A record for each client (for subdomains like auth.alpha.platform.nl)
resource "hetznerdns_record" "client_wildcard" {
for_each = var.clients
zone_id = data.hetznerdns_zone.main.id
name = "*.${each.value.subdomain}"
type = "A"
value = hcloud_server.client[each.key].ipv4_address
ttl = 300
}
# AAAA Records for IPv6
resource "hetznerdns_record" "client_aaaa" {
for_each = var.clients
zone_id = data.hetznerdns_zone.main.id
name = each.value.subdomain
type = "AAAA"
value = hcloud_server.client[each.key].ipv6_address
ttl = 300
}
*/