File tree Expand file tree Collapse file tree 3 files changed +28
-92
lines changed Expand file tree Collapse file tree 3 files changed +28
-92
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -150,3 +150,22 @@ resource "aws_security_group_rule" "ingress_through_https" {
150150 protocol = " tcp"
151151 source_security_group_id = module. ecs-alb . aws_security_group_lb_access_sg_id
152152}
153+
154+ module "ecs-autoscaling" {
155+ count = var. enable_autoscaling ? 1 : 0
156+
157+ source = " cn-terraform/ecs-service-autoscaling/aws"
158+ version = " 1.0.0"
159+
160+ name_prefix = var. name_prefix
161+ ecs_cluster_name = var. ecs_cluster_name
162+ ecs_service_name = aws_ecs_service. service . name
163+ max_cpu_threshold = var. max_cpu_threshold
164+ min_cpu_threshold = var. min_cpu_threshold
165+ max_cpu_evaluation_period = var. max_cpu_evaluation_period
166+ min_cpu_evaluation_period = var. min_cpu_evaluation_period
167+ max_cpu_period = var. max_cpu_period
168+ min_cpu_period = var. min_cpu_period
169+ scale_target_max_capacity = var. scale_target_max_capacity
170+ scale_target_min_capacity = var. scale_target_min_capacity
171+ }
Original file line number Diff line number Diff line change @@ -122,8 +122,16 @@ variable "container_name" {
122122# ------------------------------------------------------------------------------
123123# AWS ECS SERVICE AUTOSCALING
124124# ------------------------------------------------------------------------------
125+ variable "enable_autoscaling" {
126+ description = " (Optional) If true, autoscaling alarms will be created."
127+ type = bool
128+ default = true
129+ }
130+
125131variable "ecs_cluster_name" {
126- description = " Name of the ECS cluster"
132+ description = " (Optional) Name of the ECS cluster. Required only if autoscaling is enabled"
133+ type = string
134+ default = null
127135}
128136
129137variable "max_cpu_threshold" {
@@ -174,9 +182,6 @@ variable "scale_target_min_capacity" {
174182# ------------------------------------------------------------------------------
175183# AWS LOAD BALANCER
176184# ------------------------------------------------------------------------------
177- # ------------------------------------------------------------------------------
178- # APPLICATION LOAD BALANCER
179- # ------------------------------------------------------------------------------
180185variable "lb_internal" {
181186 description = " (Optional) If true, the LB will be internal."
182187 type = bool
You can’t perform that action at this time.
0 commit comments