Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions modules/service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1521,8 +1521,8 @@ resource "aws_appautoscaling_target" "this" {
region = var.region

# Desired needs to be between or equal to min/max
min_capacity = min(var.autoscaling_min_capacity, var.desired_count)
max_capacity = max(var.autoscaling_max_capacity, var.desired_count)
min_capacity = var.autoscaling_min_capacity
max_capacity = var.autoscaling_max_capacity

resource_id = "service/${local.cluster_name}/${try(aws_ecs_service.this[0].name, aws_ecs_service.ignore_task_definition[0].name)}"
scalable_dimension = "ecs:service:DesiredCount"
Expand All @@ -1546,7 +1546,7 @@ resource "aws_appautoscaling_policy" "this" {

region = var.region

name = coalesce(each.value.name, each.key)
name = each.key
policy_type = each.value.policy_type
resource_id = aws_appautoscaling_target.this[0].resource_id
scalable_dimension = aws_appautoscaling_target.this[0].scalable_dimension
Expand Down Expand Up @@ -1842,14 +1842,14 @@ resource "aws_appautoscaling_scheduled_action" "this" {

region = var.region

name = coalesce(each.value.name, each.key)
name = each.key
service_namespace = aws_appautoscaling_target.this[0].service_namespace
resource_id = aws_appautoscaling_target.this[0].resource_id
scalable_dimension = aws_appautoscaling_target.this[0].scalable_dimension

scalable_target_action {
min_capacity = each.value.min_capacity
max_capacity = each.value.max_capacity
min_capacity = each.value.max_capacity
max_capacity = each.value.min_capacity
}

schedule = each.value.schedule
Expand Down