Sha256: 8ca7339a7085ed7a267119c2634c40a72e95c4c4c4968bf30a975f68eb7c25aa

Contents?: true

Size: 933 Bytes

Versions: 1

Compression:

Stored size: 933 Bytes

Contents

# frozen_string_literal: true

require 'ruby_terraform'

require_relative './base'
require_relative './actions'

module RSpec
  module Terraform
    module Helpers
      class Destroy < Base
        include Actions::ExecuteIfRequired
        include Actions::Validate
        include Actions::Clean
        include Actions::Init
        include Actions::Destroy

        def execute(overrides = {}, &block)
          parameters = resolve_parameters(overrides, &block)

          execute_if_required(parameters) do
            validate(parameters)
            clean(parameters)
            init(parameters)
            destroy(parameters)
          end
        end

        private

        def required_parameters(execution_mode)
          {
            in_place: [:configuration_directory],
            isolated: %i[source_directory configuration_directory]
          }[execution_mode] || []
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-terraform-0.1.0.pre.47 lib/rspec/terraform/helpers/destroy.rb