Module: Cfnlego

Defined in:
lib/cfndsl/cfnlego.rb,
lib/cfndsl/cfnlego/resource.rb,
lib/cfndsl/cfnlego/cloudformation.rb

Overview

Cfnlego

Defined Under Namespace

Classes: CloudFormation, Resource

Class Method Summary collapse

Class Method Details

.resourcesObject



13
14
15
# File 'lib/cfndsl/cfnlego.rb', line 13

def self.resources
  @resources ||= CfnDsl::Specification.load_file.resources
end

.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