Post-Tyranny-Tech-Infrastru.../tofu/outputs.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

48 lines
1.3 KiB
HCL

# Outputs for Ansible and monitoring
# Client server IPs
output "client_ips" {
description = "Map of client names to their IPv4 addresses"
value = {
for name, server in hcloud_server.client :
name => server.ipv4_address
}
}
# Client FQDNs
output "client_fqdns" {
description = "Map of client names to their fully qualified domain names"
value = {
for name, config in var.clients :
name => "${config.subdomain}.${var.base_domain}"
}
}
# All client information
output "clients" {
description = "Complete client information"
value = {
for name, server in hcloud_server.client :
name => {
id = server.id
name = server.name
ipv4 = server.ipv4_address
ipv6 = server.ipv6_address
location = server.location
fqdn = "${var.clients[name].subdomain}.${var.base_domain}"
apps = var.clients[name].apps
}
}
}
# Ansible inventory hint
output "ansible_inventory_hint" {
description = "Hint for Ansible dynamic inventory configuration"
value = <<-EOT
Configure Ansible to use Hetzner dynamic inventory:
1. Set HCLOUD_TOKEN environment variable
2. Use ansible/hcloud.yml inventory configuration
3. Run: ansible-inventory -i ansible/hcloud.yml --graph
EOT
}