Files
code-tools/tf/variables.tf
2025-09-06 01:43:47 +00:00

322 lines
9.4 KiB
HCL

# =============================================================================
# Variable Definitions
# Modular Development Environment Configuration
# =============================================================================
# =============================================================================
# Project Configuration
# =============================================================================
variable "project_name" {
description = "Name of the project for resource tagging and identification"
type = string
default = "dev-environment"
validation {
condition = can(regex("^[a-z0-9-]+$", var.project_name))
error_message = "Project name must contain only lowercase letters, numbers, and hyphens."
}
}
variable "environment" {
description = "Environment designation (dev, staging, prod)"
type = string
default = "dev"
validation {
condition = contains(["dev", "staging", "prod"], var.environment)
error_message = "Environment must be one of: dev, staging, prod."
}
}
# =============================================================================
# Docker Configuration
# =============================================================================
variable "docker_socket" {
description = "Docker daemon socket URI (empty for default)"
type = string
default = ""
}
variable "devcontainer_image" {
description = "Development container image with all required tools pre-installed"
type = string
default = "mcr.microsoft.com/devcontainers/universal:2-linux"
}
# =============================================================================
# Development Tool Versions
# =============================================================================
variable "node_version" {
description = "Node.js version to install"
type = string
default = "20"
validation {
condition = contains(["18", "20", "21"], var.node_version)
error_message = "Node.js version must be one of: 18, 20, 21."
}
}
variable "python_version" {
description = "Python version to install"
type = string
default = "3.12"
validation {
condition = contains(["3.10", "3.11", "3.12"], var.python_version)
error_message = "Python version must be 3.10, 3.11, or 3.12."
}
}
variable "postgres_version" {
description = "PostgreSQL version"
type = string
default = "17"
validation {
condition = contains(["13", "14", "15", "16", "17"], var.postgres_version)
error_message = "PostgreSQL version must be one of: 13, 14, 15, 16, 17."
}
}
variable "redis_version" {
description = "Redis version"
type = string
default = "7"
validation {
condition = contains(["6", "7"], var.redis_version)
error_message = "Redis version must be 6 or 7."
}
}
variable "qdrant_version" {
description = "Qdrant vector database version"
type = string
default = "latest"
}
# =============================================================================
# Service Configuration
# =============================================================================
variable "postgres_password" {
description = "PostgreSQL postgres user password"
type = string
default = "devpassword"
sensitive = true
validation {
condition = length(var.postgres_password) >= 8
error_message = "PostgreSQL password must be at least 8 characters long."
}
}
variable "redis_password" {
description = "Redis authentication password"
type = string
default = "devpassword"
sensitive = true
validation {
condition = length(var.redis_password) >= 8
error_message = "Redis password must be at least 8 characters long."
}
}
variable "postgres_max_connections" {
description = "Maximum PostgreSQL connections"
type = number
default = 100
validation {
condition = var.postgres_max_connections >= 20 && var.postgres_max_connections <= 1000
error_message = "PostgreSQL max connections must be between 20 and 1000."
}
}
variable "redis_max_memory" {
description = "Redis maximum memory (e.g., '256mb', '1gb')"
type = string
default = "512mb"
validation {
condition = can(regex("^[0-9]+[kmg]b$", var.redis_max_memory))
error_message = "Redis max memory must be in format like '256mb' or '1gb'."
}
}
# =============================================================================
# Network Configuration
# =============================================================================
variable "pgadmin_port" {
description = "pgAdmin web interface port"
type = number
default = 5050
validation {
condition = var.pgadmin_port >= 1024 && var.pgadmin_port <= 65535
error_message = "pgAdmin port must be between 1024 and 65535."
}
}
variable "pgadmin_email" {
description = "pgAdmin login email"
type = string
default = "admin@dev.local"
validation {
condition = can(regex("^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$", var.pgadmin_email))
error_message = "pgAdmin email must be a valid email address."
}
}
variable "pgadmin_password" {
description = "pgAdmin login password"
type = string
default = "adminpassword"
sensitive = true
validation {
condition = length(var.pgadmin_password) >= 8
error_message = "pgAdmin password must be at least 8 characters long."
}
}
# =============================================================================
# Development Packages
# =============================================================================
variable "npm_packages" {
description = "Global npm packages to install"
type = list(string)
default = [
"repomix", # Repository packaging tool
"create-next-app", # Next.js app generator
"nodemon", # Development server auto-reload
"concurrently", # Run multiple commands
"@types/node", # Node.js TypeScript types
"typescript", # TypeScript compiler
"eslint", # JavaScript linter
"prettier" # Code formatter
]
}
variable "python_packages" {
description = "Python packages to install via uv"
type = list(string)
default = [
"fastapi", # Modern web framework
"uvicorn", # ASGI server
"requests", # HTTP library
"pandas", # Data manipulation
"numpy", # Numerical computing
"psycopg2-binary", # PostgreSQL adapter
"redis", # Redis client
"qdrant-client", # Qdrant vector database client
"python-dotenv" # Environment variable loading
]
}
variable "system_packages" {
description = "Additional system packages to install"
type = list(string)
default = [
"make", # Build tool
"tree", # Directory tree viewer
"jq", # JSON processor
"curl", # HTTP client
"wget", # File downloader
"unzip", # Archive extractor
"build-essential" # Compilation tools
]
}
# =============================================================================
# AI Development Tools
# =============================================================================
variable "install_claude_code" {
description = "Install Claude Code CLI for AI assistance"
type = bool
default = true
}
variable "install_cursor_support" {
description = "Install Cursor IDE support and extensions"
type = bool
default = true
}
variable "install_windsurf_support" {
description = "Install Windsurf IDE support"
type = bool
default = false
}
# =============================================================================
# Performance Configuration
# =============================================================================
variable "workspace_memory_limit" {
description = "Memory limit for workspace container (MB)"
type = number
default = 8192
validation {
condition = var.workspace_memory_limit >= 2048 && var.workspace_memory_limit <= 32768
error_message = "Workspace memory limit must be between 2048MB (2GB) and 32768MB (32GB)."
}
}
variable "workspace_cpu_limit" {
description = "CPU limit for workspace container (cores)"
type = number
default = 4
validation {
condition = var.workspace_cpu_limit >= 1 && var.workspace_cpu_limit <= 16
error_message = "Workspace CPU limit must be between 1 and 16 cores."
}
}
# =============================================================================
# Feature Toggles
# =============================================================================
variable "enable_pgadmin" {
description = "Enable pgAdmin web interface (resource intensive)"
type = bool
default = true
}
variable "enable_monitoring" {
description = "Enable container monitoring and metrics collection"
type = bool
default = false
}
variable "enable_jupyter" {
description = "Enable Jupyter Lab for data science workflows"
type = bool
default = false
}
# =============================================================================
# Common Tags
# =============================================================================
variable "common_tags" {
description = "Common tags to apply to all resources"
type = map(string)
default = {
Environment = "development"
ManagedBy = "terraform"
Purpose = "remote-development"
}
}