Sha256: a6b96b188fbd20d1a929c570ce5547c26fed586ecf4cdf6aa828dd2bf6c4b514

Contents?: true

Size: 1.81 KB

Versions: 6

Compression:

Stored size: 1.81 KB

Contents

require "sfn"

module Sfn
  module ApiProvider
    module Terraform

      # Disable remote template storage
      def store_template(*_)
      end

      # No formatting required on stack results
      def format_nested_stack_results(*_)
        {}
      end

      # Extract current parameters from parent template
      #
      # @param stack [SparkleFormation]
      # @param stack_name [String]
      # @param c_stack [Miasma::Models::Orchestration::Stack]
      # @return [Hash]
      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

      # Disable parameter validate as we can't adjust them without template modifications
      def validate_stack_parameter(*_)
        true
      end

      # Determine if parameter was set via intrinsic function
      #
      # @param val [Object]
      # @return [TrueClass, FalseClass]
      def function_set_parameter?(val)
        if val
          val.start_with?("${")
        end
      end

      # Override requirement of nesting bucket
      def validate_nesting_bucket!
        true
      end

      # Override template content extraction to disable scrub behavior
      #
      # @param thing [SparkleFormation, Hash]
      # @return [Hash]
      def template_content(thing, *_)
        if thing.is_a?(SparkleFormation)
          config[:sparkle_dump] ? thing.sparkle_dump : thing.dump
        else
          thing
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sfn-3.1.8 lib/sfn/api_provider/terraform.rb
sfn-3.1.6 lib/sfn/api_provider/terraform.rb
sfn-3.1.4 lib/sfn/api_provider/terraform.rb
sfn-3.1.2 lib/sfn/api_provider/terraform.rb
sfn-3.1.0 lib/sfn/api_provider/terraform.rb
sfn-3.0.32 lib/sfn/api_provider/terraform.rb