Skip to content

Commit

Permalink
fix devide by 0
Browse files Browse the repository at this point in the history
  • Loading branch information
marciogoda committed May 2, 2024
1 parent f4d43e1 commit 3b35383
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ locals {
service_name = "${var.env}-${var.release["component"]}"
full_service_name = "${local.service_name}${var.name_suffix}"
lower_weight = ceil((var.spot_capacity_percentage / 100))
high_weight = floor(local.lower_weight / (var.spot_capacity_percentage / 100))
spot_weight = var.spot_capacity_percentage <= 50 ? local.lower_weight : local.high_weight
ondemand_weight = var.spot_capacity_percentage <= 50 ? local.high_weight : local.lower_weight
higher_weight = local.lower_weight == 0 ? 1 : ceil(local.lower_weight / (var.spot_capacity_percentage / 100)) - 1
spot_weight = var.spot_capacity_percentage <= 50 ? local.lower_weight : local.higher_weight
ondemand_weight = var.spot_capacity_percentage <= 50 ? local.higher_weight : local.lower_weight
}

module "ecs_update_monitor" {
Expand Down

0 comments on commit 3b35383

Please sign in to comment.