Skip to content

Commit

Permalink
Fix for_each
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmacedot committed Aug 26, 2024
1 parent 2ec80be commit 2bbeec4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion _variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ variable "enable_schedule" {
variable "scale_in_schedules" {
type = list(object({
cron = string
name = ""
name = string
}))
default = null
}
Expand Down
2 changes: 1 addition & 1 deletion appautoscaling.tf
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ resource "aws_appautoscaling_policy" "scale_custom" {
}

resource "aws_appautoscaling_scheduled_action" "scale_in_schedules" {
for_each = var.scale_in_schedules
for_each = { for schedule in var.scale_in_schedules : schedule.name => schedule }
count = var.enable_schedule ? 1 : 0
name = "${var.name}-${each.value}-scale-in"
service_namespace = aws_appautoscaling_target.ecs[0].service_namespace
Expand Down

0 comments on commit 2bbeec4

Please sign in to comment.