From 01440810acc9be2ddd9927fb53b2482a7f31822b Mon Sep 17 00:00:00 2001 From: Jazeel <48310743+jaezeu@users.noreply.github.com> Date: Tue, 7 Feb 2023 12:45:08 +0800 Subject: [PATCH] Update on service name and autoscaling(min_capacity,max_capacity, target_cpu_value) (#11) Co-authored-by: Jazeel Co-authored-by: niroz89 --- main.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.tf b/main.tf index 611bb06..e88f06c 100644 --- a/main.tf +++ b/main.tf @@ -46,7 +46,7 @@ module "service" { source = "./modules/service" - name = format("%s-%s", var.name, replace(each.key, "_", "-")) + name = lookup(each.value, "name", format("%s-%s", var.name, replace(each.key, "_", "-"))) cluster_id = module.cluster.ecs_cluster_id container_definitions = each.value.service_container_definitions launch_type = var.launch_type @@ -78,9 +78,9 @@ module "service_cpu_autoscaling_policy" { name = format("%s-%s", var.name, replace(each.key, "_", "-")) enable_ecs_cpu_based_autoscaling = true - min_capacity = var.service_min_capacity - max_capacity = var.service_max_capacity - target_cpu_value = var.service_target_cpu_value + min_capacity = lookup(each.value, "service_min_capacity", var.service_min_capacity) + max_capacity = lookup(each.value, "service_max_capacity", var.service_max_capacity) + target_cpu_value = lookup(each.value, "service_target_cpu_value", var.service_target_cpu_value) ecs_cluster_name = module.cluster.ecs_cluster_name ecs_service_name = module.service[each.key].ecs_service_name }