Method: Cfnlego.run

Defined in:
lib/cfndsl/cfnlego.rb

.run(options) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/cfndsl/cfnlego.rb', line 17

def self.run(options)
  resources =
    options[:resources].each_with_object([]) do |r, list|
      /(.*),(.*)/.match(r) do |m|
        type = m[1]
        name = m[2]
        list << Cfnlego::Resource.new(type, name)
      end
    end

  begin
    return Cfnlego::CloudFormation.new(resources).render
  rescue RuntimeError => e
    warn "Error: #{e.message}"
  end
  nil
end