Sha256: c1d59859f9d2e5245cf34cae087d164b640f324be8126edef06f4247b5a35ee2

Contents?: true

Size: 1.29 KB

Versions: 31

Compression:

Stored size: 1.29 KB

Contents

require "yaml"

class Lono::Cfn
  class Create < Base
    # save_stack is the interface method
    def save_stack(params)
      create_stack(params)
    end

    # aws cloudformation create-stack --stack-name prod-hi-123456789 --parameters file://output/params/prod-hi-123456789.json --template-body file://output/prod-hi.json
    def create_stack(params)
      message = "Creating #{@stack_name.color(:green)} stack."
      if @options[:noop]
        puts "NOOP #{message}"
        return
      end

      delete_rollback_stack

      if stack_exists?(@stack_name)
        puts "Cannot create #{@stack_name.color(:green)} stack because it already exists.".color(:red)
        return
      end

      unless File.exist?(@template_path)
        puts "Cannot create #{@stack_name.color(:green)} template not found: #{@template_path}."
        return
      end

      params = {
        stack_name: @stack_name,
        parameters: params,
        capabilities: capabilities, # ["CAPABILITY_IAM", "CAPABILITY_NAMED_IAM"]
        disable_rollback: !@options[:rollback],
      }
      params[:tags] = tags unless tags.empty?
      set_template_body!(params)

      show_parameters(params, "cfn.create_stack")
      cfn.create_stack(params) # TODO: COMMENT OUT FOR TESTING
      puts message unless @options[:mute]
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
lono-6.1.11 lib/lono/cfn/create.rb
lono-6.1.10 lib/lono/cfn/create.rb
lono-6.1.9 lib/lono/cfn/create.rb
lono-6.1.8 lib/lono/cfn/create.rb
lono-6.1.7 lib/lono/cfn/create.rb
lono-6.1.6 lib/lono/cfn/create.rb
lono-6.1.5 lib/lono/cfn/create.rb
lono-6.1.4 lib/lono/cfn/create.rb
lono-6.1.3 lib/lono/cfn/create.rb
lono-6.1.2 lib/lono/cfn/create.rb
lono-6.1.1 lib/lono/cfn/create.rb
lono-6.1.0 lib/lono/cfn/create.rb
lono-6.0.1 lib/lono/cfn/create.rb
lono-6.0.0 lib/lono/cfn/create.rb
lono-5.3.4 lib/lono/cfn/create.rb
lono-5.3.3 lib/lono/cfn/create.rb
lono-5.3.2 lib/lono/cfn/create.rb
lono-5.3.1 lib/lono/cfn/create.rb
lono-5.3.0 lib/lono/cfn/create.rb
lono-5.2.8 lib/lono/cfn/create.rb