- Added system detection logic to handle different OS types (Linux, macOS, Windows). - Enhanced user creation logic to support non-root execution and proper ownership. - Updated directory creation to use dynamic home paths based on detected OS. - Improved Git configuration and metadata capture with error handling. - Modularized system package installation based on OS type. - Streamlined Node.js, Python, and Rust setup scripts with error handling. - Updated shell configuration to include dynamic aliases and environment info script. - Deprecated `devcontainer_image` variable in favor of `devcontainer_repo_url` for better repository management. - Adjusted Terraform workspace configuration to support new repository URL and caching options.
353 lines
10 KiB
HCL
353 lines
10 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 (deprecated - use devcontainer_repo_url)"
|
|
type = string
|
|
default = "mcr.microsoft.com/devcontainers/universal:2-linux"
|
|
}
|
|
|
|
variable "devcontainer_repo_url" {
|
|
description = "Git repository URL containing the devcontainer configuration"
|
|
type = string
|
|
default = "http://git.lab/vasceannie/code-tools.git"
|
|
}
|
|
|
|
variable "envbuilder_cache_repo" {
|
|
description = "Docker registry to use for caching envbuilder layers (e.g., 'ghcr.io/username/cache')"
|
|
type = string
|
|
default = "local"
|
|
}
|
|
|
|
# =============================================================================
|
|
# 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@example.com"
|
|
|
|
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
|
|
}
|
|
|
|
variable "enable_docker_in_docker" {
|
|
description = "Enable Docker-in-Docker by mounting the Docker socket (Consider using Sysbox for better security)"
|
|
type = bool
|
|
default = true
|
|
}
|
|
|
|
variable "use_sysbox_runtime" {
|
|
description = "Use Sysbox runtime for secure container isolation (requires Sysbox installed on host)"
|
|
type = bool
|
|
default = false
|
|
}
|
|
|
|
variable "block_file_transfer" {
|
|
description = "Block file transfer commands (scp, rsync, ftp, nc) to prevent data exfiltration"
|
|
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"
|
|
}
|
|
}
|