generated from dxw/terraform-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Allows configuring time based autoscaling for the Infrastructure ECS Cluster's autoscaling group. * Cron expressions can be provided to set the desired capacity to the min or max sizes. Custom scaling sizes can also be provided, to set the min/max sizes for a given cron expression (in which case the min size will be set as the desired capacity)
- Loading branch information
Showing
4 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
resource "aws_autoscaling_schedule" "ecs_infrastructure_time_based_max" { | ||
for_each = local.enable_infrastructure_ecs_cluster ? local.infrastructure_ecs_cluster_autoscaling_time_based_max : [] | ||
|
||
autoscaling_group_name = aws_autoscaling_group.infrastructure_ecs_cluster[0].name | ||
scheduled_action_name = "${local.resource_prefix}-time-based-max ${each.value}" | ||
desired_capacity = local.infrastructure_ecs_cluster_max_size | ||
min_size = -1 | ||
max_size = -1 | ||
recurrence = each.value | ||
} | ||
|
||
resource "aws_autoscaling_schedule" "ecs_infrastructure_time_based_min" { | ||
for_each = local.enable_infrastructure_ecs_cluster ? local.infrastructure_ecs_cluster_autoscaling_time_based_min : [] | ||
|
||
autoscaling_group_name = aws_autoscaling_group.infrastructure_ecs_cluster[0].name | ||
scheduled_action_name = "${local.resource_prefix}-time-based-min ${each.value}" | ||
desired_capacity = local.infrastructure_ecs_cluster_min_size | ||
min_size = -1 | ||
max_size = -1 | ||
recurrence = each.value | ||
} | ||
|
||
resource "aws_autoscaling_schedule" "ecs_infrastructure_time_based_custom" { | ||
for_each = local.enable_infrastructure_ecs_cluster ? local.infrastructure_ecs_cluster_autoscaling_time_based_custom : {} | ||
|
||
autoscaling_group_name = aws_autoscaling_group.infrastructure_ecs_cluster[0].name | ||
scheduled_action_name = "${local.resource_prefix}-time-based-custom ${each.value["cron"]} ${each.value["min"]}-${each.value["max"]}" | ||
desired_capacity = each.value["min"] | ||
min_size = each.value["min"] | ||
max_size = each.value["max"] | ||
recurrence = each.value["cron"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters