Sha256: b4492c5ad9395c2bce6cb002be062db02ba8ccb491c28ce1a3d4294e9bdc0fd3

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 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 = {}, &)
          parameters = resolve_parameters(overrides, &)

          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

1 entries across 1 versions & 1 rubygems

Version Path
rspec-terraform-0.5.0.pre.9 lib/rspec/terraform/helpers/apply.rb