variable "hcloud_token" {
  description = "Hetzner Cloud API Token"
  type        = string
  sensitive   = true
}

variable "hdns_token" {
  type = string
  sensitive = true
}

variable "ssh_public_key_path" {
  description = "Path to SSH public key"
  type        = string
}

variable "ssh_private_key_path" {
  description = "Path to SSH private key"
  type        = string
}

variable "ghcr_username" {}
variable "ghcr_token" {}

module "hetzner" {
  source = "./modules/hetzner"
  hcloud_token = var.hcloud_token
  ssh_public_key_path = var.ssh_public_key_path
  ssh_private_key_path = var.ssh_private_key_path
  name = "vw-hub"
  datacenter = "nbg1-dc3"
  hdns_token = var.hdns_token
  ghcr_token = var.ghcr_token
  ghcr_username = var.ghcr_username
}

module "minio" {
  wait_on = module.hetzner.installed
  source = "./modules/minio"
  server_ip = module.hetzner.server_ip
  server_domain = module.hetzner.server_domain
  ssh_private_key_path = var.ssh_private_key_path
}

module "valkey" {
  wait_on = module.hetzner.installed
  source = "./modules/valkey"
  server_ip = module.hetzner.server_ip
  ssh_private_key_path = var.ssh_private_key_path
}

# module "vw-hub" {
#   wait_on = module.minio.installed
#
#   source = "./modules/vw-hub"
#   server_ip = module.hetzner.server_ip
#   ssh_private_key_path = var.ssh_private_key_path
#   domain = "hub.${module.hetzner.server_domain}"
#   s3_access_key = module.minio.access_key
#   s3_secret_key = module.minio.secret_key
#   s3_server = module.minio.server
# }

output "minio_app_urls" {
  value = module.minio.app_urls
}