Skip to content

Commit

Permalink
Use a resource label, for ALB scaling purposes. (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
dipack95 authored Feb 9, 2022
1 parent 0e459d9 commit b756b9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ resource "aws_ecs_service" "service_no_autoscaling" {
tags = var.tags
}


# Service wth Auto-scaling configured.
resource "aws_ecs_service" "service_autoscaling" {
count = var.use_autoscaling ? 1 : 0
Expand Down Expand Up @@ -202,6 +201,7 @@ resource "aws_appautoscaling_policy" "ecs_service_autoscaling_policy" {
target_value = var.scaling_target_value
predefined_metric_specification {
predefined_metric_type = var.scaling_metric
resource_label = var.scaling_metric == "ALBRequestCountPerTarget" ? var.alb_scaling_target_resource_id : null
}
}
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ variable "scaling_metric" {
default = "ALBRequestCountPerTarget"
}

variable "alb_scaling_target_resource_id" {
type = string
description = "If using Application auto-scaling, and ALBRequestCountPerTarget as the scaling metric, use this resource ID as the measure"
default = ""
}

variable "vpc_id" {
description = "ID of the VPC the alb is in"
}
Expand Down

0 comments on commit b756b9c

Please sign in to comment.