Skip to content

Commit

Permalink
moved locals
Browse files Browse the repository at this point in the history
  • Loading branch information
marciogoda committed May 2, 2024
1 parent 6bcb53e commit 8347cfa
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
locals {
service_name = "${var.env}-${var.release["component"]}"
full_service_name = "${local.service_name}${var.name_suffix}"
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 = 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 All @@ -20,6 +15,12 @@ module "ecs_update_monitor" {
}

locals {
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 = var.spot_capacity_percentage <= 50 ? local.lower_weight : local.higher_weight
ondemand_weight = var.spot_capacity_percentage <= 50 ? local.higher_weight : local.lower_weight

capacity_providers = var.image_build_details["buildx"] == "true" && can(regexall("^arm64", var.image_build_details["platforms"])) ? [
{
capacity_provider = "${var.ecs_cluster}-native-scaling"
Expand Down

0 comments on commit 8347cfa

Please sign in to comment.