Skip to content

Commit

Permalink
Add cooldown variable for ECS scaling policy (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
mayank0202 authored Apr 18, 2024
1 parent e1e800e commit eea2372
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ No modules.

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_cooldown"></a> [cooldown](#input\_cooldown) | Cooldown period for scaling actions | `number` | `60` | no |
| <a name="input_ecs_cluster_name"></a> [ecs\_cluster\_name](#input\_ecs\_cluster\_name) | Name of the ECS cluster | `any` | n/a | yes |
| <a name="input_ecs_service_name"></a> [ecs\_service\_name](#input\_ecs\_service\_name) | Name of the ECS service | `any` | n/a | yes |
| <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 |
Expand Down
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ resource "aws_appautoscaling_policy" "scale_up_policy" {
scalable_dimension = "ecs:service:DesiredCount"
step_scaling_policy_configuration {
adjustment_type = "ChangeInCapacity"
cooldown = 60
cooldown = var.cooldown
metric_aggregation_type = "Maximum"
step_adjustment {
metric_interval_lower_bound = 0
Expand All @@ -75,7 +75,7 @@ resource "aws_appautoscaling_policy" "scale_down_policy" {
scalable_dimension = "ecs:service:DesiredCount"
step_scaling_policy_configuration {
adjustment_type = "ChangeInCapacity"
cooldown = 60
cooldown = var.cooldown
metric_aggregation_type = "Maximum"
step_adjustment {
metric_interval_upper_bound = 0
Expand Down
5 changes: 5 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,8 @@ variable "sns_topic_arn" {
description = "The ARN of an SNS topic to send notifications on alarm actions."
default = "" # Set an empty string as default to avoid potential errors
}
variable "cooldown" {
description = "Cooldown period for scaling actions"
type = number
default = 60 // Default value, adjust as needed
}

0 comments on commit eea2372

Please sign in to comment.