Sha256: 07bdf02d4666773098b5819482aeabd79d367578672d00de86d5078022f3b3f3

Contents?: true

Size: 987 Bytes

Versions: 7

Compression:

Stored size: 987 Bytes

Contents

class Lono::Cfn::Create < Lono::Cfn::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} stack."
    if @options[:noop]
      puts "NOOP #{message}"
      return
    end

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

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

    template_body = IO.read(@template_path)
    cfn.create_stack(
      stack_name: @stack_name,
      template_body: template_body,
      parameters: params#,
      # capabilities: ["CAPABILITY_IAM"]
    )
    puts message unless @options[:mute]
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lono-2.1.0 lib/lono/cfn/create.rb
lono-2.0.5 lib/lono/cfn/create.rb
lono-2.0.4 lib/lono/cfn/create.rb
lono-2.0.3 lib/lono/cfn/create.rb
lono-2.0.2 lib/lono/cfn/create.rb
lono-2.0.1 lib/lono/cfn/create.rb
lono-2.0.0 lib/lono/cfn/create.rb