Skip to content

Instantly share code, notes, and snippets.

@KyMidd
Created July 10, 2021 20:12
Show Gist options
  • Select an option

  • Save KyMidd/d62176a2d1c3a86fa982d2455ab01706 to your computer and use it in GitHub Desktop.

Select an option

Save KyMidd/d62176a2d1c3a86fa982d2455ab01706 to your computer and use it in GitHub Desktop.
resource "aws_appautoscaling_target" "ServiceAutoScalingTarget" {
count = var.enable_scaling ? 1 : 0
min_capacity = var.autoscale_task_weekday_scale_down
max_capacity = var.autoscale_task_weekday_scale_up
resource_id = "service/${aws_ecs_cluster.fargate_cluster.name}/${aws_ecs_service.ecs_service.name}" # service/(clusterName)/(serviceName)
scalable_dimension = "ecs:service:DesiredCount"
service_namespace = "ecs"
lifecycle {
ignore_changes = [
min_capacity,
max_capacity,
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment