Sha256: 006f61fe98e5a7b3fbc7cc6309efedbf4921c177ece719893ad0eb84506cfa23

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require 'ruby_terraform'

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

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

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

          execute_if_required(:apply, parameters) do
            validate(parameters)
            clean(parameters)
            init(parameters)
            apply(parameters)
          end
        end

        private

        def mandatory_parameters
          {
            input: false,
            auto_approve: true
          }
        end

        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

8 entries across 8 versions & 1 rubygems

Version Path
rspec-terraform-0.5.0.pre.3 lib/rspec/terraform/helpers/apply.rb
rspec-terraform-0.5.0.pre.2 lib/rspec/terraform/helpers/apply.rb
rspec-terraform-0.5.0.pre.1 lib/rspec/terraform/helpers/apply.rb
rspec-terraform-0.4.0 lib/rspec/terraform/helpers/apply.rb
rspec-terraform-0.3.0.pre.1 lib/rspec/terraform/helpers/apply.rb
rspec-terraform-0.2.0 lib/rspec/terraform/helpers/apply.rb
rspec-terraform-0.1.0.pre.49 lib/rspec/terraform/helpers/apply.rb
rspec-terraform-0.1.0.pre.48 lib/rspec/terraform/helpers/apply.rb