variable "wait_on" {
  type        = any
  description = "Resources to wait on"
  default     = true
}

variable "server_ip" {
  type = string
}

variable "ssh_private_key_path" {
  type = string
}

module "oci-proxy" {
  source = "../quadlet-app"
  wait_on = var.wait_on

  server_ip            = var.server_ip
  ssh_private_key_path = var.ssh_private_key_path

  app_name = "oci-proxy"
  image    = "docker.io/tecnativa/docker-socket-proxy"
  ports    = ["2375:2375"]
  volumes  = ["/run/user/1001/podman/podman.sock:/var/run/docker.sock:Z"]

  environment = {
    LOG_LEVEL = "info"
    EVENTS = 1
    PING = 1
    VERSION = 1
    AUTH = 0
    SECRETS = 0
    POST = 1
    BUILD = 0
    COMMIT = 0
    CONFIGS = 0
    CONTAINERS = 1
    DISTRIBUTION = 0
    EXEC = 0
    IMAGES = 1
    INFO = 1
    NETWORKS = 1
    NODES = 0
    PLUGINS = 0
    SERVICES = 1
    SESSION = 0
    SWARM = 0
    SYSTEM = 0
    TASKS = 1
    VOLUMES = 1
  }
}

output "app_urls" {
  value = module.oci-proxy.app_urls
}

output "installed" {
  value = true
  depends_on = [module.oci-proxy.installed]
}