Sha256: 18147ce64c337f096dde676d0f312431052005e981a9a6cb85925619f968f013

Contents?: true

Size: 990 Bytes

Versions: 26

Compression:

Stored size: 990 Bytes

Contents

module Ufo::Cfn::Stack::Builder::Resources::SecurityGroup
  class Ecs < Base
    def build
      return unless managed_security_groups?

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

    def properties
      props = {
        GroupDescription: "Allow http to client host",
        VpcId: {Ref: "Vpc"},
        SecurityGroupEgress: [
          {
            IpProtocol: "-1",
            CidrIp: "0.0.0.0/0",
            Description: "outbound traffic"
          }
        ],
        Tags: [
          {
            Key: "Name",
            Value: @stack_name,
          }
        ]
      }

      if vars[:elb_type] == "network"
        props[:SecurityGroupIngress] = {
          IpProtocol: "tcp",
          FromPort: vars[:container][:port],
          ToPort: vars[:container][:port],
          CidrIp: "0.0.0.0/0",
          Description: "docker ephemeral port range for network elb",
        }
      end

      props
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
ufo-6.0.5 lib/ufo/cfn/stack/builder/resources/security_group/ecs.rb
ufo-6.0.4 lib/ufo/cfn/stack/builder/resources/security_group/ecs.rb
ufo-6.0.3 lib/ufo/cfn/stack/builder/resources/security_group/ecs.rb
ufo-6.0.2 lib/ufo/cfn/stack/builder/resources/security_group/ecs.rb
ufo-6.0.1 lib/ufo/cfn/stack/builder/resources/security_group/ecs.rb
ufo-6.0.0 lib/ufo/cfn/stack/builder/resources/security_group/ecs.rb