output "ansible_inventory_yaml" {
  description = "Ansible inventory in YAML format"
  sensitive   = false
  value = yamlencode({
    all = {
      children = {
        app = {
          hosts = {
            (hcloud_server.app.name) = {
              ansible_host = hcloud_server.app.ipv4_address
              ansible_user = "root"
              private_ip   = local.app_private_ip
            }
          }
        }
        db = {
          hosts = {
            (hcloud_server.db.name) = {
              ansible_host = hcloud_server.db.ipv4_address
              ansible_user = "root"
              private_ip   = local.db_private_ip
            }
          }
        }
      }
    }
  })
}

output "test_private_ips" {
  description = "Private IPs assigned to test nodes"
  sensitive   = false
  value = {
    app_01 = local.app_private_ip
    db_01    = local.db_private_ip
  }
}

output "test_public_ips" {
  description = "Public IPv4 addresses of test nodes"
  sensitive   = false
  value = {
    app_01 = hcloud_server.app.ipv4_address
    db_01    = hcloud_server.db.ipv4_address
  }
}

output "test_floating_ip" {
  description = "Floating IP assigned to the app entry point"
  sensitive   = false
  value       = hcloud_floating_ip.app.ip_address
}
