Sha256: da10d539791c9161d9ec94f6aabf5367424113d2f72db5380de448cc5ff77c27
Contents?: true
Size: 1.35 KB
Versions: 24
Compression:
Stored size: 1.35 KB
Contents
class Ufo::Cfn::Stack::Builder::Resources class Listener < Base def build { Type: "AWS::ElasticLoadBalancingV2::Listener", Condition: "CreateElbIsTrue", Properties: properties, } end def properties { DefaultActions: default_actions, LoadBalancerArn: {Ref: "Elb"}, Port: port, Protocol: protocol, } end def protocol vars[:default_listener_protocol] end def port 80 end def default_actions elb = Ufo.config.elb default_actions = elb.default_actions # allow use to override for full control like redirection support return default_actions if default_actions redirect = elb.redirect if redirect.enabled [redirect_action(redirect)] else [default_action] end end def redirect_action(redirect) { Type: "redirect", RedirectConfig: { Protocol: redirect.protocol, StatusCode: "HTTP_#{redirect.code}", # HTTP_301 and HTTP_302 are valid Port: redirect.port, } } end def default_action { Type: "forward", TargetGroupArn: { "Fn::If": [ "ElbTargetGroupIsBlank", {Ref: "TargetGroup"}, {Ref: "ElbTargetGroup"} ] } } end end end
Version data entries
24 entries across 24 versions & 1 rubygems