variable "aws_region" { description = "AWS region in which to deploy the infrastructure." type = string default = "ap-south-1" } variable "project_name" { description = "Short project identifier used in resource names." type = string default = "ecs-app" validation { condition = can(regex("^[a-zA-Z0-9-]+$", var.project_name)) error_message = "project_name may contain only letters, numbers, and hyphens." } } variable "environment" { description = "Deployment environment, such as dev, test, staging, or prod." type = string default = "dev" } variable "vpc_cidr" { description = "CIDR block for the VPC." type = string default = "10.20.0.0/16" } variable "availability_zone_count" { description = "Number of Availability Zones to use (2 or 3 recommended)." type = number default = 2 validation { condition = var.availability_zone_count >= 2 && var.availability_zone_count <= 3 error_message = "availability_zone_count must be 2 or 3." } } variable "public_subnet_newbits" { description = "Additional subnet bits used to calculate public subnet CIDRs." type = number default = 8 } variable "private_subnet_newbits" { description = "Additional subnet bits used to calculate private subnet CIDRs." type = number default = 8 } variable "single_nat_gateway" { description = "Use one NAT Gateway to reduce cost; set false for one NAT Gateway per AZ." type = bool default = true } variable "container_image" { description = "Container image URI. Use an immutable image tag or digest for production." type = string default = "public.ecr.aws/nginx/nginx:stable" } variable "container_port" { description = "Port exposed by the application container." type = number default = 80 } variable "health_check_path" { description = "HTTP health-check path on the container." type = string default = "/" } variable "cpu" { description = "Fargate task CPU units. Valid values include 256, 512, 1024, 2048, 4096." type = number default = 256 } variable "memory" { description = "Fargate task memory in MiB; must be compatible with cpu." type = number default = 512 } variable "desired_count" { description = "Desired number of ECS tasks." type = number default = 2 } variable "assign_public_ip" { description = "Assign public IP to tasks. Normally false because tasks run in private subnets." type = bool default = false } variable "enable_container_insights" { description = "Enable ECS Container Insights on the cluster." type = bool default = true } variable "log_retention_days" { description = "CloudWatch log retention in days." type = number default = 30 } variable "enable_autoscaling" { description = "Enable ECS service target-tracking autoscaling." type = bool default = true } variable "autoscaling_min_capacity" { description = "Minimum number of tasks when autoscaling is enabled." type = number default = 2 } variable "autoscaling_max_capacity" { description = "Maximum number of tasks when autoscaling is enabled." type = number default = 6 } variable "cpu_target_value" { description = "Target average ECS service CPU utilization percentage." type = number default = 60 } variable "alb_ingress_cidrs" { description = "CIDR ranges allowed to reach the ALB. Restrict this for internal applications." type = list(string) default = ["0.0.0.0/0"] } variable "tags" { description = "Additional tags applied to supported resources." type = map(string) default = {} }