lib/rspec/terraform/helpers/plan.rb in rspec-terraform-0.1.0.pre.41 vs lib/rspec/terraform/helpers/plan.rb in rspec-terraform-0.1.0.pre.42

- old
+ new

@@ -10,17 +10,27 @@ module Terraform module Helpers # rubocop:disable Metrics/ClassLength class Plan 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) @@ -114,19 +124,19 @@ File.join(parameters[:configuration_directory], plan_file) ) end def init_command - RubyTerraform::Commands::Init.new(binary: binary) + RubyTerraform::Commands::Init.new(command_options) end def plan_command - RubyTerraform::Commands::Plan.new(binary: binary) + RubyTerraform::Commands::Plan.new(command_options) end def show_command(opts = {}) - RubyTerraform::Commands::Show.new(opts.merge(binary: binary)) + RubyTerraform::Commands::Show.new(command_options.merge(opts)) end def init_parameters(parameters) init_parameters = parameters.merge( chdir: parameters[:configuration_directory], @@ -164,9 +174,19 @@ chdir: parameters[:configuration_directory], path: plan_file, no_color: true, json: true ) + end + + def command_options + { + binary: binary, + logger: logger, + stdin: stdin, + stdout: stdout, + stderr: stderr + } end end # rubocop:enable Metrics/ClassLength end end