lib/rspec/terraform/helpers/apply.rb in rspec-terraform-0.1.0.pre.41 vs lib/rspec/terraform/helpers/apply.rb in rspec-terraform-0.1.0.pre.42
- old
+ new
@@ -5,19 +5,30 @@
require_relative '../configuration/var_captor'
module RSpec
module Terraform
module Helpers
+ # rubocop:disable Metrics/ClassLength
class Apply
attr_reader(
- :configuration_provider, :binary, :execution_mode
+ :configuration_provider,
+ :binary,
+ :logger,
+ :stdin,
+ :stdout,
+ :stderr,
+ :execution_mode
)
def initialize(opts = {})
@configuration_provider =
opts[:configuration_provider] || Configuration.identity_provider
@binary = opts[:binary] || 'terraform'
+ @logger = opts[:logger]
+ @stdin = opts[:stdin]
+ @stdout = opts[:stdout]
+ @stderr = opts[:stderr]
@execution_mode = opts[:execution_mode] || :in_place
end
def execute(overrides = {}, &block)
parameters = with_configuration_provider_parameters(overrides)
@@ -95,15 +106,15 @@
def apply(parameters)
apply_command.execute(apply_parameters(parameters))
end
def init_command
- RubyTerraform::Commands::Init.new(binary: binary)
+ RubyTerraform::Commands::Init.new(command_options)
end
def apply_command
- RubyTerraform::Commands::Apply.new(binary: binary)
+ RubyTerraform::Commands::Apply.new(command_options)
end
def init_parameters(parameters)
init_parameters = parameters.merge(
chdir: parameters[:configuration_directory],
@@ -132,9 +143,20 @@
end
apply_parameters
end
# rubocop:enable Metrics/MethodLength
+
+ def command_options
+ {
+ binary: binary,
+ logger: logger,
+ stdin: stdin,
+ stdout: stdout,
+ stderr: stderr
+ }
+ end
end
+ # rubocop:enable Metrics/ClassLength
end
end
end