Skip to content

Commit

Permalink
fix calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
marciogoda committed May 2, 2024
1 parent 03b1cd2 commit 6a406d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
locals {
service_name = "${var.env}-${var.release["component"]}"
full_service_name = "${local.service_name}${var.name_suffix}"
p = var.spot_capacity_percentage
p = var.spot_capacity_percentage <= 50 ? var.spot_capacity_percentage : 100 - var.spot_capacity_percentage
lower_weight = ceil((local.p / 100))
higher_weight = local.lower_weight == 0 ? 1 : ceil(local.lower_weight / (local.p / 100)) - 1
spot_weight = local.p <= 50 || local.p == 100 ? local.lower_weight : local.higher_weight
Expand Down

0 comments on commit 6a406d5

Please sign in to comment.