Module: CloudFormationRSpec::Matchers::ChangeSet

Defined in:
lib/cloudformation_rspec/matchers/change_set.rb

Instance Method Summary collapse

Instance Method Details

#generate_change_set(stack) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/cloudformation_rspec/matchers/change_set.rb', line 4

def generate_change_set(stack)
  if stack[:compiler] == :sparkleformation
    CloudFormationRSpec::ChangeSet.from_sparkleformation_template(
      template_file: stack[:template_file],
      compile_state: stack[:compile_state],
      parameters: stack[:parameters]
    )
  else
    if !stack[:template_body]
      raise ArgumentError, "You must pass either :template_body or set :compiler and pass in compiler specific options"
    end
    CloudFormationRSpec::ChangeSet.from_cloudformation_template(template_body: stack[:template_body], parameters: stack[:parameters])
  end
end

#resource_ids_with_resource_type(change_set_result, resource_type) ⇒ Object



19
20
21
22
23
# File 'lib/cloudformation_rspec/matchers/change_set.rb', line 19

def resource_ids_with_resource_type(change_set_result, resource_type)
  change_set_result.changes.select do |change|
    change.resource_type == resource_type
  end.map(&:logical_resource_id)
end