Sha256: 6a0de03f8585bac0bb8c748d6f50d5bbf8a675c2aa94704930d4443f2d9f4f7d

Contents?: true

Size: 1.28 KB

Versions: 15

Compression:

Stored size: 1.28 KB

Contents

require "yaml"

class Lono::Cfn
  class Create < Base
    # save is the interface method
    # 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 save(parameters)
      message = "Creating #{@stack.color(:green)} stack."
      if @options[:noop]
        puts "NOOP #{message}"
        return
      end

      delete_rollback_stack

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

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

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

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
lono-7.5.2 lib/lono/cfn/create.rb
lono-7.5.1 lib/lono/cfn/create.rb
lono-7.5.0 lib/lono/cfn/create.rb
lono-7.4.11 lib/lono/cfn/create.rb
lono-7.4.10 lib/lono/cfn/create.rb
lono-7.4.9 lib/lono/cfn/create.rb
lono-7.4.8 lib/lono/cfn/create.rb
lono-7.4.7 lib/lono/cfn/create.rb
lono-7.4.6 lib/lono/cfn/create.rb
lono-7.4.5 lib/lono/cfn/create.rb
lono-7.4.4 lib/lono/cfn/create.rb
lono-7.4.3 lib/lono/cfn/create.rb
lono-7.4.2 lib/lono/cfn/create.rb
lono-7.4.1 lib/lono/cfn/create.rb
lono-7.4.0 lib/lono/cfn/create.rb