Module: Convection::DSL::Template::Resource::EC2SecurityGroup

Included in:
Model::Template::Resource::EC2SecurityGroup
Defined in:
lib/convection/model/template/resource/aws_ec2_security_group.rb

Overview

DSL For EC2SecurityGroup rules

Instance Method Summary collapse

Instance Method Details

#egress_rule(protocol = nil, port = nil, destination = nil, &block) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/convection/model/template/resource/aws_ec2_security_group.rb', line 22

def egress_rule(protocol = nil, port = nil, destination = nil, &block)
  rule = Model::Template::Resource::EC2SecurityGroup::Rule.new("#{ name }EgressGroupRule", @template)
  rule.protocol = protocol unless protocol.nil?
  rule.from = port unless port.nil?
  rule.to = port unless port.nil?
  rule.destination = destination unless destination.nil?

  rule.instance_exec(&block) if block
  security_group_egress << rule
end

#ingress_rule(protocol = nil, port = nil, source = nil, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/convection/model/template/resource/aws_ec2_security_group.rb', line 11

def ingress_rule(protocol = nil, port = nil, source = nil, &block)
  rule = Model::Template::Resource::EC2SecurityGroup::Rule.new("#{ name }IngressGroupRule", @template)
  rule.protocol = protocol unless protocol.nil?
  rule.from = port unless port.nil?
  rule.to = port unless port.nil?
  rule.source = source unless source.nil?

  rule.instance_exec(&block) if block
  security_group_ingress << rule
end