Skip to content

Commit

Permalink
Merge pull request #47 from smartward-com-au/allow-distinctInstance-c…
Browse files Browse the repository at this point in the history
…onstraint

Allow DistinctInstance on ECS-Service
  • Loading branch information
jaredbrook authored Mar 26, 2020
2 parents 48e0c13 + 500eff3 commit 70af344
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ecs-service.cfndsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@


strategy = external_parameters.fetch(:scheduling_strategy, nil)
task_placement_distinct_instance_constraint = external_parameters.fetch(:distinct_instance_constraint, false)
health_check_grace_period = external_parameters.fetch(:health_check_grace_period, nil)
placement_strategies = external_parameters.fetch(:placement_strategies, nil)
ECS_Service('Service') do
Expand All @@ -444,6 +445,7 @@
TaskDefinition Ref('Task')
SchedulingStrategy scheduling_strategy if !strategy.nil?
PlacementStrategies placement_strategies if !placement_strategies.nil?
PlacementConstraints [{Type: "distinctInstance"}] if task_placement_distinct_instance_constraint

if service_loadbalancer.any?
Role Ref('Role') unless awsvpc_enabled
Expand Down
3 changes: 2 additions & 1 deletion ecs-service.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ log_retention: 7
#
# volumes:
# - data-volume:/data
# NOTE: task placement constraint only suport Type="memberOf"
# NOTE: task_placement_constraint only suport Type="memberOf". Use distinct_instance_constraint: true for Type="distinctInstance"
# task_placement_constraints:
# - "attribute:ecs.availability-zone==ap-southeast-2a"
# distinct_instance_constraint: true
#
# placement_strategies:
# - Field: memory
Expand Down

0 comments on commit 70af344

Please sign in to comment.