Skip to content

Commit

Permalink
Merge pull request #22 from timhassett/master
Browse files Browse the repository at this point in the history
Added optional name key for ListenerRules
  • Loading branch information
Guslington authored Mar 12, 2019
2 parents f24ccfe + 8e79044 commit 7ba356b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion ecs-service.cfndsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,15 @@
listener_conditions << { Field: "host-header", Values: hosts }
end

ElasticLoadBalancingV2_ListenerRule("TargetRule#{rule['priority']}") do
if rule.key?("name")
rule_name = rule['name']
elsif rule['priority'].is_a? Integer
rule_name = "TargetRule#{rule['priority']}"
else
rule_name = "TargetRule#{index}"
end

ElasticLoadBalancingV2_ListenerRule(rule_name) do
Actions [{ Type: "forward", TargetGroupArn: Ref('TaskTargetGroup') }]
Conditions listener_conditions
ListenerArn Ref("Listener")
Expand Down
3 changes: 2 additions & 1 deletion ecs-service.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ log_retention: 7
# path: /status
# code: 200
# rules:
# - path: /v2/*
# - name: apiv2
# path: /v2/*
# host: api.*
# priority: 10
# - path: /api/v1/*
Expand Down

0 comments on commit 7ba356b

Please sign in to comment.