Skip to content

Commit

Permalink
Merge pull request #6 from Guslington/develop
Browse files Browse the repository at this point in the history
add priority on the rule
  • Loading branch information
Guslington authored Jul 18, 2018
2 parents b899325 + 53cc916 commit 3be18c4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 13 deletions.
8 changes: 4 additions & 4 deletions ecs-service.cfndsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@
Tags tags if tags.any?
end

listener_conditions = []
targetgroup['rules'].each do |rule|
targetgroup['rules'].each_with_index do |rule, index|
listener_conditions = []
if rule.key?("path")
listener_conditions << { Field: "path-pattern", Values: [ rule["path"] ] }
end
Expand All @@ -253,11 +253,11 @@
listener_conditions << { Field: "host-header", Values: hosts }
end

ElasticLoadBalancingV2_ListenerRule("#{rule['name']}TargetRule") do
ElasticLoadBalancingV2_ListenerRule("TargetRule#{rule['priority']}") do
Actions [{ Type: "forward", TargetGroupArn: Ref('TaskTargetGroup') }]
Conditions listener_conditions
ListenerArn Ref("Listener")
Priority targetgroup['priority'].to_i
Priority rule['priority'].to_i
end

end
Expand Down
36 changes: 27 additions & 9 deletions ecs-service.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,32 @@ log_retention: 7
# network_mode: awsvpc

# task_definition:
# nginx:
# image: nginx
# cpu: 1024
# memory: 256
# api:
# cpu: 256
# memory: 2048
# repo: some.custom.repo
# image: api
# tag_param: ApiTag
# ports:
# - 80
#
# - 8080
# env_vars:
# KEY: value

# targetgroup:
# name: default
# container: nginx
# port: 80
# name: api
# container: api
# port: 8080
# protocol: http
# listener: http
# healthcheck:
# path: /status
# code: 200
# rules:
# - path: /v2/*
# host: api.*
# priority: 10
# - path: /api/v1/*
# host: app.*
# priority: 20
# tags:
# Name: api

0 comments on commit 3be18c4

Please sign in to comment.