Files
HetznerTerra/terraform/outputs.tf

66 lines
1.8 KiB
Terraform
Raw Normal View History

output "control_plane_ips" {
description = "Public IPs of control plane nodes"
value = [for cp in hcloud_server.control_plane : cp.ipv4_address]
}
output "control_plane_names" {
description = "Control plane hostnames"
value = [for cp in hcloud_server.control_plane : cp.name]
}
output "control_plane_private_ips" {
description = "Private IPs of control plane nodes"
value = [
for idx, cp in hcloud_server.control_plane :
try(one(cp.network).ip, cidrhost(var.subnet_cidr, 10 + idx))
]
}
output "primary_control_plane_ip" {
description = "Public IP of the primary control plane (first node)"
value = hcloud_server.control_plane[0].ipv4_address
}
output "worker_ips" {
description = "Public IPs of worker nodes"
value = [for worker in hcloud_server.workers : worker.ipv4_address]
}
output "worker_names" {
description = "Worker hostnames"
value = [for worker in hcloud_server.workers : worker.name]
}
output "worker_private_ips" {
description = "Private IPs of worker nodes"
value = [
for idx, worker in hcloud_server.workers :
try(one(worker.network).ip, cidrhost(var.subnet_cidr, 20 + idx))
]
}
output "ssh_private_key_path" {
description = "Path to SSH private key"
value = var.ssh_private_key
}
output "cluster_name" {
description = "Cluster name"
value = var.cluster_name
}
output "tailscale_tailnet" {
description = "Tailnet domain suffix"
value = var.tailscale_tailnet
}
output "network_cidr" {
description = "Private network CIDR"
value = var.subnet_cidr
}
output "kubeconfig_command" {
description = "Command to fetch kubeconfig"
value = "ssh root@${hcloud_server.control_plane[0].ipv4_address} 'cat /etc/rancher/k3s/k3s.yaml' > kubeconfig && sed -i 's/127.0.0.1/${hcloud_server.control_plane[0].ipv4_address}/g' kubeconfig"
}