variable "env_prefix" {
  type        = string
  description = "Prefix of the environment, lowercased"
}

variable "project_group" {
  type        = string
  description = "Project group name, lowercased"
}

variable "project" {
  type        = string
  description = "Project name, lowercased"
}

variable "common_tags" {
  type        = map(string)
  description = "Common tags to add for the objects"
  default     = {}
}

variable "region" {
  type        = string
  default     = "us-east-1"
  description = "Region where resources will be created"
}

variable "vpc_id" {
  type        = string
  description = "VPC id where network resources will be created"
}

variable "cluster_arn" {
  type        = string
  description = "ARN of ECS cluster of the environment"
}

variable "subnets" {
  type        = list(string)
  description = "List of subnets which ECS Service will use"
}

variable "security_groups" {
  type        = list(string)
  description = "List of security groups which will be applied to ECS Service"
}

variable "is_public" {
  type        = bool
  description = "Whether or not container will be created with public IP"
  default     = false
}

variable "desired_count" {
  type        = number
  description = "Amount of tasks running that will be maintained under ECS service"
  default     = 1
}

variable "route53_zone_id" {
  type        = string
  default     = ""
  description = "ID of the DNS hosted zone in Route 53. If set, dns record will be created."
}

variable "alb_dns_name" {
  type        = string
  default     = ""
  description = "DNS name of ALB. Required if route53_zone_id is set"
}

variable "alb_zone_id" {
  type        = string
  default     = ""
  description = "DNS zone id of ALB. Required if route53_zone_id is set"
}

variable "route53_eval_health" {
  default     = false
  description = "Allow route53 to evaluate health of the targets behind it."
}

variable "task_definition_arn" {
  type        = string
  description = "The family and revision (family:revision) or full ARN of the task definition that you want to run in your service."
}

variable "enable_ecs_managed_tags" {
  default     = false
  description = "Specifies whether to enable Amazon ECS managed tags for the tasks within the service."
}

variable "namespace_id" {
  type        = string
  description = "The ID of the namespace that you want to use to create the service."
  default     = null
}

variable "sd_enabled" {
  type        = bool
  description = "Specify whether you want to have integration with service discovery of not."
  default     = false
}

variable "min_percent" {
  type        = number
  description = "The lower limit (as a percentage of the service's desiredCount) of the number of running tasks that must remain running and healthy in a service during a deployment."
  default     = 100
}
variable "max_percent" {
  type        = number
  description = "The upper limit (as a percentage of the service's desiredCount) of the number of running tasks that can be running in a service during a deployment. "
  default     = 200
}

variable "platform_version" {
  type        = string
  description = "Fargate version"
  default     = "1.4.0"
}

variable "target_groups_settings" {
  type = list(object({
    name                 = string,
    tg_port              = number,
    container_port       = number,
    deregistration_delay = number,
    health_check_path    = string,
    health_check_port    = any,
    health_check_matcher = string,
    url                  = string,
    https_listener_arn   = string,
  }))
  description = "List of maps with target groups settings"
}

variable "wait_for_steady_state" {
  type        = bool
  description = "If true, Terraform will wait for the service to reach a steady state before continuing."
  default     = true
}
