# ===============================================================================================================
# variables.tf - Variables de infraestructura para proyectosacc
# Descripción:
#       Define todas las variables parametrizables de la infraestructura AWS.
#
# Autor: Área de Tecnología y Desarrollo - CCsoft
# ===============================================================================================================

# -------------------------------------------------------------------------------
# Generales
# -------------------------------------------------------------------------------
variable "aws_region" {
  description = "Región principal de AWS"
  type        = string
  default     = "mx-central-1"
}

variable "project_name" {
  description = "Nombre del proyecto"
  type        = string
  default     = "proyectosacc"
}

variable "environment" {
  description = "Ambiente de despliegue (dev, uat, prod)"
  type        = string
}

variable "domain_name" {
  description = "Dominio principal de la aplicación"
  type        = string
  default     = "sacc.ccsoft.mx"
}

# -------------------------------------------------------------------------------
# Red
# -------------------------------------------------------------------------------
variable "vpc_cidr" {
  description = "CIDR block de la VPC"
  type        = string
  default     = "10.0.0.0/16"
}

variable "availability_zones" {
  description = "Zonas de disponibilidad a utilizar"
  type        = list(string)
  default     = ["mx-central-1a", "mx-central-1b"]
}

# -------------------------------------------------------------------------------
# EC2 (API Backend)
# -------------------------------------------------------------------------------
variable "ec2_instance_type" {
  description = "Tipo de instancia EC2 para la API"
  type        = string
  default     = "t3.small"
}

variable "ec2_ami" {
  description = "AMI de Ubuntu 22.04 LTS"
  type        = string
  # AMI oficial de Ubuntu 22.04 LTS en mx-central-1 (validada: 2026-04-10)
  default = "ami-09289f290e76061f8"
}

variable "ec2_root_volume_size" {
  description = "Tamaño del volumen raíz en GB"
  type        = number
  default     = 20
}

variable "ec2_key_name" {
  description = "Nombre del Key Pair SSH para acceso inicial (administrado externamente)"
  type        = string
  default     = null
}

variable "pipeline_public_key" {
  description = "Llave pública SSH del pipeline CI/CD (usuario thoth)"
  type        = string
}

# -------------------------------------------------------------------------------
# RDS (Base de datos)
# -------------------------------------------------------------------------------
variable "db_instance_class" {
  description = "Clase de instancia RDS"
  type        = string
  default     = "db.t3.micro"
}

variable "db_engine" {
  description = "Motor de base de datos"
  type        = string
  default     = "mariadb"
}

variable "db_engine_version" {
  description = "Versión del motor de base de datos"
  type        = string
  default     = "10.11"
}

variable "db_name" {
  description = "Nombre de la base de datos inicial"
  type        = string
  default     = "sacc_db"
}

variable "db_username" {
  description = "Usuario administrador de la base de datos"
  type        = string
  default     = "sacc_admin"
}

variable "db_password" {
  description = "Contraseña del usuario administrador de la base de datos"
  type        = string
  sensitive   = true
}

variable "db_allocated_storage" {
  description = "Almacenamiento asignado a RDS en GB"
  type        = number
  default     = 20
}

# -------------------------------------------------------------------------------
# S3
# -------------------------------------------------------------------------------
variable "s3_frontend_bucket" {
  description = "Nombre del bucket S3 para el frontend React"
  type        = string
}

variable "s3_artifacts_bucket" {
  description = "Nombre del bucket S3 para artefactos de la API"
  type        = string
}

# -------------------------------------------------------------------------------
# CloudFront / ACM
# -------------------------------------------------------------------------------
variable "cloudfront_price_class" {
  description = "Clase de precio de CloudFront"
  type        = string
  default     = "PriceClass_100"
}
