variable "env_prefix" {
  type        = string
  description = "The short name of the environment."
}

variable "project_group" {
  type        = string
  description = "The short name of the platform."
}

variable "name_suffix" {
  type        = string
  description = "suffix to use in case multiple datadog agents are under the same env/platform"
  default     = ""
}

/**
 * Datadog configuration
 */
variable "ecs_cluster_arns_list" {
  type    = list(string)
  default = []
}

variable "family" {
  type        = string
  description = "A unique name for your task definition."
  default     = ""
}

variable "task_role_arn" {
  type        = string
  description = "(Optional) The ARN of IAM role that allows your Amazon ECS container task to make calls to other AWS services."
}

variable "exec_role_arn" {
  type        = string
  description = "(Optional) The Amazon Resource Name (ARN) of the task execution role that the Amazon ECS container agent and the Docker daemon can assume."
}

variable "cpu" {
  type        = number
  description = "The number of cpu units used by the task."
  default     = 256
}

variable "memory" {
  type        = number
  description = "The amount (in MiB) of memory used by the task."
  default     = 512
}

variable "dd_container_image" {
  type        = string
  description = "The image used to start the container with Datadog agent."
  default     = "public.ecr.aws/datadog/agent:latest"
}

variable "dd_container_name" {
  type        = string
  description = "The name of the container."
  default     = "datadog-agent"
}

variable "dd_logs_injection" {
  type        = bool
  description = "Specify whether you want to use Datadog logs injection or not."
  default     = false
}

variable "dd_apm_enabled" {
  type        = bool
  description = "Specify whether you want to use Datadog APM or not."
  default     = false
}

variable "dd_profiling_enabled" {
  type        = bool
  description = "Specify whether you want to use Datadog Profiling or not"
  default     = false
}

variable "dd_service" {
  type        = string
  description = "Datadog service name. Set byt default to {project_group}-{container_name}"
  default     = ""
}

variable "dd_env" {
  type        = string
  description = "Datadog env. Set byt default to variable env_prefix"
  default     = ""
}

variable "dd_env_vars" {
  type = list(object({
    name  = string
    value = string
  }))
  description = "The environment variables to pass to the container with Datadog agent. This is a list of maps. map_environment overrides environment."
  default     = []
}
variable "dd_port_mappings" {
  type = list(object({
    containerPort = number
    hostPort      = number
    protocol      = string
  }))
  description = "The port mappings to configure for the container. This is a list of maps. Each map should contain \"containerPort\", \"hostPort\", and \"protocol\", where \"protocol\" is one of \"tcp\" or \"udp\". If using containers in a task with the awsvpc or host network mode, the hostPort can either be left blank or set to the same value as the containerPort"
  default     = [
    {
      containerPort = 8126
      hostPort      = 8126
      protocol      = "tcp"
    }
  ]
}


variable "dd_secrets" {
  type = list(object({
    name      = string
    valueFrom = string
  }))
  description = "The secrets to pass to the container with Datadog agent. This is a list of maps."
  default     = null
}


variable "dd_awslogs_group" {
  type        = string
  description = "The name of the log group where awslogs driver will send events from container with Datadog."
}

variable "dd_docker_labels" {
  type    = map(string)
  default = {}
}

// Logs configuration
variable "awslogs_group_name" {
  type        = string
  description = "The name of the log group where awslogs driver will send events."
  default     = ""
}

variable "awslogs_region" {
  type        = string
  description = "The region to which the awslogs log driver should send your Docker logs. "
  default     = "us-east-1"
}

variable "awslogs_stream_prefix" {
  type        = string
  description = "The stream-prefix for your logs."
  default     = "ecs"
}

variable "awslogs_retention" {
  type        = number
  description = "Logs will expire after this period of time"
  default     = 180
}

variable "tags" {
  type        = map(string)
  description = "Key-value map of resource tags."
  default     = {}
}

variable "docker_labels" {
  type        = map(string)
  description = "Key-value map of docker labels."
  default     = null
}

variable "stop_timeout" {
  type        = number
  description = "Time duration (in seconds) to wait before the container is forcefully killed if it doesn't exit normally on its own"
  default     = null
}

variable "user" {
  type        = string
  description = "The user to use inside the container."
  default     = null
}

variable "init_process_enabled" {
  type    = bool
  default = null
}
