Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pack_and_distinct variable to toggle placement strategy #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module "ecs_update_monitor" {

module "service" {
source = "mergermarket/load-balanced-ecs-service-no-target-group/acuris"
version = "2.0.2"
version = "2.0.3"

name = "${local.service_name}${var.name_suffix}"
cluster = var.ecs_cluster
Expand All @@ -25,6 +25,7 @@ module "service" {
target_group_arn = var.target_group_arn
deployment_minimum_healthy_percent = var.deployment_minimum_healthy_percent
deployment_maximum_percent = var.deployment_maximum_percent
pack_and_distinct = var.pack_and_distinct
}

module "taskdef" {
Expand Down
9 changes: 7 additions & 2 deletions test/files/create_ecs_service.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@
{ "field": "attribute:ecs.availability-zone", "type": "spread" },
{ "field": "instanceId", "type": "spread" }
],
"placement_constraints": [],
"placement_constraints": [
{
"expression": "agentConnected == true",
"type": "memberOf"
}
],
"propagate_tags": null,
"scheduling_strategy": "REPLICA",
"service_registries": [],
Expand All @@ -92,7 +97,7 @@
"load_balancer": [{}],
"network_configuration": [],
"ordered_placement_strategy": [{}, {}],
"placement_constraints": [],
"placement_constraints": [{}],
"platform_version": true,
"service_registries": [],
"task_definition": true
Expand Down
9 changes: 7 additions & 2 deletions test/files/create_ecs_service_with_image_id.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@
{ "field": "attribute:ecs.availability-zone", "type": "spread" },
{ "field": "instanceId", "type": "spread" }
],
"placement_constraints": [],
"placement_constraints": [
{
"expression": "agentConnected == true",
"type": "memberOf"
}
],
"propagate_tags": null,
"scheduling_strategy": "REPLICA",
"service_registries": [],
Expand All @@ -92,7 +97,7 @@
"load_balancer": [{}],
"network_configuration": [],
"ordered_placement_strategy": [{}, {}],
"placement_constraints": [],
"placement_constraints": [{}],
"platform_version": true,
"service_registries": [],
"task_definition": true
Expand Down
9 changes: 7 additions & 2 deletions test/files/create_ecs_service_with_name_suffix.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@
"type": "spread"
}
],
"placement_constraints": [],
"placement_constraints": [
{
"expression": "agentConnected == true",
"type": "memberOf"
}
],
"propagate_tags": null,
"scheduling_strategy": "REPLICA",
"service_registries": [],
Expand All @@ -115,7 +120,7 @@
{},
{}
],
"placement_constraints": [],
"placement_constraints": [{}],
"platform_version": true,
"service_registries": [],
"task_definition": true
Expand Down
9 changes: 7 additions & 2 deletions test/files/create_ecs_service_with_task_role_policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,12 @@
"type": "spread"
}
],
"placement_constraints": [],
"placement_constraints": [
{
"expression": "agentConnected == true",
"type": "memberOf"
}
],
"propagate_tags": null,
"scheduling_strategy": "REPLICA",
"service_registries": [],
Expand All @@ -115,7 +120,7 @@
{},
{}
],
"placement_constraints": [],
"placement_constraints": [{}],
"platform_version": true,
"service_registries": [],
"task_definition": true
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,10 @@ variable "image_id" {
description = "ECR image_id for the ecs container"
type = string
default = ""
}

variable "pack_and_distinct" {
description = "Enable distinct instance and task binpacking for better cluster utilisation. Enter 'true' for clusters with auto scaling groups. Enter 'false' for clusters with no ASG and instant counts less than or equal to desired tasks"
type = string
default = "false"
}