Sha256: 357d234ab5481f6b9d74053da28361a5ef8373a7c0368320b7af39f5f7d50283

Contents?: true

Size: 1.26 KB

Versions: 10

Compression:

Stored size: 1.26 KB

Contents

module Ufo::Cfn::Stack::Builder::Resources::SecurityGroup
  class Elb < Base
    def build
      # Always create elb security group it seems like its required
      return unless vars[:elb_type] == "application"

      {
        Type: "AWS::EC2::SecurityGroup",
        Condition: "CreateElbIsTrue",
        Properties: properties
      }
    end

    def properties
      port = Ufo.config.elb.port # 80
      props = {
        GroupDescription: "Allow http to client host",
        VpcId: {Ref: "Vpc"},
        SecurityGroupIngress: [
          {
            IpProtocol: "tcp",
            FromPort: port,
            ToPort: port,
            CidrIp: "0.0.0.0/0"
          }
        ],
        SecurityGroupEgress: [
          {
            IpProtocol: "tcp",
            FromPort: "0",
            ToPort: "65535",
            CidrIp: "0.0.0.0/0"
          }
        ],
        Tags: [
          {
            Key: "Name",
            Value: "#{@stack_name}-elb"
          }
        ]
      }

      if vars[:create_listener_ssl]
        ssl_port = Ufo.config.elb.ssl.port
        props[:SecurityGroupIngress] << {
          IpProtocol: "tcp",
          FromPort: ssl_port,
          ToPort: ssl_port,
          CidrIp: "0.0.0.0/0"
        }
      end

      props
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ufo-6.3.13 lib/ufo/cfn/stack/builder/resources/security_group/elb.rb
ufo-6.3.12 lib/ufo/cfn/stack/builder/resources/security_group/elb.rb
ufo-6.3.11 lib/ufo/cfn/stack/builder/resources/security_group/elb.rb
ufo-6.3.10 lib/ufo/cfn/stack/builder/resources/security_group/elb.rb
ufo-6.3.9 lib/ufo/cfn/stack/builder/resources/security_group/elb.rb
ufo-6.3.8 lib/ufo/cfn/stack/builder/resources/security_group/elb.rb
ufo-6.3.7 lib/ufo/cfn/stack/builder/resources/security_group/elb.rb
ufo-6.3.6 lib/ufo/cfn/stack/builder/resources/security_group/elb.rb
ufo-6.3.5 lib/ufo/cfn/stack/builder/resources/security_group/elb.rb
ufo-6.3.4 lib/ufo/cfn/stack/builder/resources/security_group/elb.rb