Skip to content

Commit eea2372

Browse files
authored
Add cooldown variable for ECS scaling policy (#35)
1 parent e1e800e commit eea2372

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ No modules.
7979

8080
| Name | Description | Type | Default | Required |
8181
|------|-------------|------|---------|:--------:|
82+
| <a name="input_cooldown"></a> [cooldown](#input\_cooldown) | Cooldown period for scaling actions | `number` | `60` | no |
8283
| <a name="input_ecs_cluster_name"></a> [ecs\_cluster\_name](#input\_ecs\_cluster\_name) | Name of the ECS cluster | `any` | n/a | yes |
8384
| <a name="input_ecs_service_name"></a> [ecs\_service\_name](#input\_ecs\_service\_name) | Name of the ECS service | `any` | n/a | yes |
8485
| <a name="input_max_cpu_evaluation_period"></a> [max\_cpu\_evaluation\_period](#input\_max\_cpu\_evaluation\_period) | The number of periods over which data is compared to the specified threshold for max cpu metric alarm | `string` | `"3"` | no |

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ resource "aws_appautoscaling_policy" "scale_up_policy" {
5555
scalable_dimension = "ecs:service:DesiredCount"
5656
step_scaling_policy_configuration {
5757
adjustment_type = "ChangeInCapacity"
58-
cooldown = 60
58+
cooldown = var.cooldown
5959
metric_aggregation_type = "Maximum"
6060
step_adjustment {
6161
metric_interval_lower_bound = 0
@@ -75,7 +75,7 @@ resource "aws_appautoscaling_policy" "scale_down_policy" {
7575
scalable_dimension = "ecs:service:DesiredCount"
7676
step_scaling_policy_configuration {
7777
adjustment_type = "ChangeInCapacity"
78-
cooldown = 60
78+
cooldown = var.cooldown
7979
metric_aggregation_type = "Maximum"
8080
step_adjustment {
8181
metric_interval_upper_bound = 0

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,8 @@ variable "sns_topic_arn" {
7373
description = "The ARN of an SNS topic to send notifications on alarm actions."
7474
default = "" # Set an empty string as default to avoid potential errors
7575
}
76+
variable "cooldown" {
77+
description = "Cooldown period for scaling actions"
78+
type = number
79+
default = 60 // Default value, adjust as needed
80+
}

0 commit comments

Comments
 (0)