variables.tf
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
variable "name" {
  description = "Name prefix for the ASG and launch template"
  type        = string
}

variable "ami_id" {
  description = "AMI ID for the launch template"
  type        = string
}

variable "instance_type" {
  description = "EC2 instance type"
  type        = string
}

variable "security_group_ids" {
  description = "Security group IDs for launch template"
  type        = list(string)
}

variable "iam_instance_profile_arn" {
  description = "ARN of the IAM instance profile"
  type        = string
  default     = null
}

variable "key_name" {
  description = "EC2 key pair name"
  type        = string
  default     = null
}

variable "user_data" {
  description = "Base64-encoded user data"
  type        = string
  default     = null
}

variable "root_volume_size" {
  description = "Root EBS volume size in GiB"
  type        = number
  default     = 20
}

variable "root_volume_kms_key_id" {
  description = "KMS key ID for root volume encryption"
  type        = string
  default     = null
}

variable "metadata_http_tokens" {
  description = "IMDSv2 setting — required or optional"
  type        = string
  default     = "required"
}

variable "vpc_zone_identifier" {
  description = "List of subnet IDs for the ASG"
  type        = list(string)
}

variable "min_size" {
  description = "Minimum number of instances"
  type        = number
  default     = 1
}

variable "max_size" {
  description = "Maximum number of instances"
  type        = number
  default     = 3
}

variable "desired_capacity" {
  description = "Desired number of instances"
  type        = number
  default     = 1
}

variable "health_check_type" {
  description = "EC2 or ELB health check type"
  type        = string
  default     = "EC2"
}

variable "target_group_arns" {
  description = "ALB/NLB target group ARNs to associate"
  type        = list(string)
  default     = []
}

variable "scaling_policies" {
  description = "Map of target-tracking scaling policies"
  type = map(object({
    predefined_metric_type = optional(string, "ASGAverageCPUUtilization")
    target_value           = optional(number, 60)
    cooldown               = optional(number, 300)
  }))
  default = {}
}

variable "lifecycle_hooks" {
  description = "Map of lifecycle hooks"
  type = map(object({
    lifecycle_transition = string
    heartbeat_timeout    = optional(number, 60)
    default_result       = optional(string, "CONTINUE")
    notification_arn     = optional(string, null)
  }))
  default = {}
}

variable "warm_pool_enabled" {
  description = "Enable warm pool for faster scale-out"
  type        = bool
  default     = false
}

variable "warm_pool_min_size" {
  description = "Minimum number of instances in the warm pool"
  type        = number
  default     = 1
}

variable "tags" {
  description = "Resource tags to apply to all resources"
  type        = map(string)
  default     = {}
}