variable "workflow" {
  type = string
}

variable "parameters" {
  type = map(string)
}

variable "check_before_destroy" {
  type        = bool
  default     = true
  description = "check if resource in k8s has been removed before destroy terraform resource"
}

variable "finalizer" {
  type = object({
    workflow   = string
    parameters = map(string)
  })
  default = null
}

variable "kubeconfig_path" {
  type    = string
  default = ""
  validation {
    condition     = length(var.services) == 0 || var.kubeconfig_path != ""
    error_message = "kubeconfig_path must be provided if services are defined"
  }
}

variable "gh_repo" {
  type    = string
  default = "tidbcloud/app-delivery"
}

variable "gh_ref" {
  type    = string
  default = "main"
}

variable "timeout" {
  type    = number
  default = 3600
}

variable "services" {
  type = list(object({
    name      = string
    namespace = optional(string, "default")
    wait_for  = optional(string, "")
  }))
  default = []
}

variable "wait_workflow_success" {
  type    = bool
  default = false
}
