Sha256: a76dfef3118c6e4ac25a4db399b5e2008f6317584dfa7b8f098ec4f53318d3bb
Contents?: true
Size: 1.05 KB
Versions: 15
Compression:
Stored size: 1.05 KB
Contents
require 'json' module Stackster class StackCreater def initialize(args) @config = args[:config] @logger = @config.logger @entry = args[:entry] @name = args[:name] @template = read_template_from_file args[:template_file] end def create @logger.info "Creating Cloud Formation stack #{@name}." cloud_formation.create :name => @name, :parameters => read_parameters_from_entry, :template => @template end private def cloud_formation @cf ||= AWS::CloudFormation.new :config => @config end def read_template_from_file(template_file) file = File.open template_file file.read end def read_parameters_from_template t = JSON.parse @template t['Parameters'] ? t['Parameters'].keys : [] end def read_parameters_from_entry h = {} attributes = @entry.attributes read_parameters_from_template.each do |p| h[p] = attributes[p] if attributes[p] end h end end end
Version data entries
15 entries across 15 versions & 1 rubygems