Class: Lono::Cfn::Create

Inherits:
Base
  • Object
show all
Defined in:
lib/lono/cfn/create.rb

Instance Method Summary collapse

Methods inherited from Base

#build_files, #build_scripts, #capabilities, #check_files, #check_for_errors, #command_with_iam, #continue_update_rollback, #continue_update_rollback_sure?, #delete_rollback_stack, #ensure_s3_bucket_exist, #exit_unless_updatable!, #generate_all, #generate_templates, #initialize, #param_generator, #post_process_templates, #pretty_path, #prompt_for_iam, #quit, #run, #set_template_body!, #show_parameters, #stack_status, #starting_message, #status, #switch_current, #tags, #upload_files, #upload_scripts, #upload_templates

Methods included from Util

#are_you_sure?

Methods included from Suffix

#allow_suffix?, #append_suffix, #random_suffix, #remove_suffix, #stack_name_suffix

Methods included from Lono::Conventions

#template_param_convention

Methods included from Blueprint::Root

#bundler_groups, #find_blueprint_root, #require_bundle_gems, #set_blueprint_root

Methods included from AwsServices

#cfn, #ec2, #iam, #s3, #s3_presigner, #s3_resource, #sts

Methods included from AwsServices::Util

#find_stack, #rollback_complete?, #stack_exists?, #testing_update?

Constructor Details

This class inherits a constructor from Lono::Cfn::Base

Instance Method Details

#create_stack(params) ⇒ Object

aws cloudformation create-stack –stack-name prod-hi-123456789 –parameters file://output/params/prod-hi-123456789.json –template-body file://output/prod-hi.json



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/lono/cfn/create.rb', line 11

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

#save_stack(params) ⇒ Object

save_stack is the interface method



6
7
8
# File 'lib/lono/cfn/create.rb', line 6

def save_stack(params)
  create_stack(params)
end