7e0c764f3f
- Configurar permisos sudo completos para usuario thoth: * Editar /etc/sacc4/sacc4.env * Gestionar servicios api-sacc4-*.service * Editar archivos systemd * Control total de /opt/sacc4 - Eliminar acceso SSH abierto (0.0.0.0/0) - Agregar soporte AWS Systems Manager Session Manager - Actualizar llave SSH a sacc-prod-key-2026 - Preservar tags de scheduling (AutoStart/AutoStop) en EC2 y RDS - Agregar variable allowed_ssh_cidrs para acceso de emergencia BREAKING CHANGE: SSH restringido, usar Session Manager como acceso principal
155 lines
4.5 KiB
Terraform
155 lines
4.5 KiB
Terraform
# ===============================================================================================================
|
|
# 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
|
|
}
|
|
|
|
variable "allowed_ssh_cidrs" {
|
|
description = "Lista de CIDRs permitidos para acceso SSH (vacío = deshabilitado). Preferir AWS Systems Manager Session Manager en lugar de SSH."
|
|
type = list(string)
|
|
default = []
|
|
}
|
|
|
|
# -------------------------------------------------------------------------------
|
|
# 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"
|
|
}
|