Module: Sfn::ApiProvider::Terraform

Defined in:
lib/sfn/api_provider/terraform.rb

Instance Method Summary collapse

Instance Method Details

#extract_current_nested_template_parameters(stack, stack_name, c_stack) ⇒ Hash

Extract current parameters from parent template

Parameters:

  • stack (SparkleFormation)
  • stack_name (String)
  • c_stack (Miasma::Models::Orchestration::Stack)

Returns:

  • (Hash)


22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/sfn/api_provider/terraform.rb', line 22

def extract_current_nested_template_parameters(stack, stack_name, c_stack)
  if c_stack && c_stack.data[:parent_stack]
    c_stack.data[:parent_stack].sparkleish_template(:remove_wrapper).fetch(
      :resources, stack_name, :properties, :parameters, Smash.new
    )
  elsif stack.parent
    val = stack.parent.compile.resources.set!(stack_name).properties
    val.nil? ? Smash.new : val._dump
  else
    Smash.new
  end
end

#format_nested_stack_results(*_) ⇒ Object

No formatting required on stack results



12
13
14
# File 'lib/sfn/api_provider/terraform.rb', line 12

def format_nested_stack_results(*_)
  {}
end

#function_set_parameter?(val) ⇒ TrueClass, FalseClass

Determine if parameter was set via intrinsic function

Parameters:

  • val (Object)

Returns:

  • (TrueClass, FalseClass)


44
45
46
47
48
# File 'lib/sfn/api_provider/terraform.rb', line 44

def function_set_parameter?(val)
  if val
    val.start_with?("${")
  end
end

#store_template(*_) ⇒ Object

Disable remote template storage



8
9
# File 'lib/sfn/api_provider/terraform.rb', line 8

def store_template(*_)
end

#template_content(thing, *_) ⇒ Hash

Override template content extraction to disable scrub behavior

Parameters:

  • thing (SparkleFormation, Hash)

Returns:

  • (Hash)


59
60
61
62
63
64
65
# File 'lib/sfn/api_provider/terraform.rb', line 59

def template_content(thing, *_)
  if thing.is_a?(SparkleFormation)
    config[:sparkle_dump] ? thing.sparkle_dump : thing.dump
  else
    thing
  end
end

#validate_nesting_bucket!Object

Override requirement of nesting bucket



51
52
53
# File 'lib/sfn/api_provider/terraform.rb', line 51

def validate_nesting_bucket!
  true
end

#validate_stack_parameter(*_) ⇒ Object

Disable parameter validate as we can't adjust them without template modifications



36
37
38
# File 'lib/sfn/api_provider/terraform.rb', line 36

def validate_stack_parameter(*_)
  true
end