Sha256: 89c786317fe4b3102a4d4090effe3d299aac6958c061cc2b1614bf57d782ddf4

Contents?: true

Size: 939 Bytes

Versions: 5

Compression:

Stored size: 939 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(:destroy, 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

5 entries across 5 versions & 1 rubygems

Version Path
rspec-terraform-0.5.0.pre.8 lib/rspec/terraform/helpers/destroy.rb
rspec-terraform-0.5.0.pre.7 lib/rspec/terraform/helpers/destroy.rb
rspec-terraform-0.5.0.pre.6 lib/rspec/terraform/helpers/destroy.rb
rspec-terraform-0.5.0.pre.5 lib/rspec/terraform/helpers/destroy.rb
rspec-terraform-0.5.0.pre.4 lib/rspec/terraform/helpers/destroy.rb