Class: Ec2::Resources

Inherits:
Object
  • Object
show all
Defined in:
lib/ec2/resources.rb

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Resources

Returns a new instance of Resources.



7
8
9
# File 'lib/ec2/resources.rb', line 7

def initialize(file)
  @file = file
end

Instance Method Details

#applyObject



25
26
27
# File 'lib/ec2/resources.rb', line 25

def apply
  instance_eval(File.read(@file), @file)
end

#security_group(name, &block) ⇒ Object



15
16
17
18
# File 'lib/ec2/resources.rb', line 15

def security_group(name, &block)
  sg = SecurityGroup.new(name, vpc_id: @vpc_id)
  sg.created &block
end

#subnet(name, &block) ⇒ Object



20
21
22
23
# File 'lib/ec2/resources.rb', line 20

def subnet(name, &block)
  subnet = Subnet.new(name, vpc_id: @vpc_id)
  subnet.created &block
end

#vpc_id(vpc_id) ⇒ Object



11
12
13
# File 'lib/ec2/resources.rb', line 11

def vpc_id(vpc_id)
  @vpc_id = vpc_id
end