Class: AwsHelpers::CloudFormation::StackProvision

Inherits:
Object
  • Object
show all
Defined in:
lib/aws_helpers/cloud_formation/stack_provision.rb

Instance Method Summary collapse

Constructor Details

#initialize(cloud_formation_client, s3_client, stack_name, template, options = {}) ⇒ StackProvision

Returns a new instance of StackProvision


15
16
17
18
19
20
21
22
23
# File 'lib/aws_helpers/cloud_formation/stack_provision.rb', line 15

def initialize(cloud_formation_client, s3_client, stack_name, template,  options = {})
  @cloud_formation_client = cloud_formation_client
  @s3_client = s3_client
  @stack_name = stack_name
  @template = template
  @parameters = options[:parameters]
  @capabilities = options[:capabilities]
  @upload_template = UploadTemplate.new(s3_client, stack_name, template, options[:bucket_name], options[:bucket_encrypt])
end

Instance Method Details

#executeObject


25
26
27
28
29
30
31
32
# File 'lib/aws_helpers/cloud_formation/stack_provision.rb', line 25

def execute
  template_url = @upload_template.execute
  if create_rollback?
    delete
  end
  exists? ? update(template_url) : create(template_url)
  StackOutputs.new(@cloud_formation_client, @stack_name).execute
end