Class: Kitchen::Terraform::OutputsReader

Inherits:
Object
  • Object
show all
Defined in:
lib/kitchen/terraform/outputs_reader.rb

Overview

OutputsReader is the class of objects which read Terraform output variables.

Instance Method Summary collapse

Constructor Details

#initialize(command_executor:) ⇒ Kitchen::Terraform::OutputsReader

#initialize prepares a new instance of the class.

Parameters:



41
42
43
44
# File 'lib/kitchen/terraform/outputs_reader.rb', line 41

def initialize(command_executor:)
  self.command_executor = command_executor
  self.no_outputs_defined = /no\\ outputs\\ defined/
end

Instance Method Details

#read(command:, options:) {|json_outputs| ... } ⇒ self

#read reads the output variables.

Parameters:

Yield Parameters:

  • json_outputs (String)

    the output variables as a string of JSON.

Returns:

  • (self)

Raises:

  • (Kitchen::TransientFailure)

    if running the output command fails.



29
30
31
32
33
34
35
# File 'lib/kitchen/terraform/outputs_reader.rb', line 29

def read(command:, options:)
  run command: command, options: options do |json_outputs:|
    yield json_outputs: json_outputs
  end

  self
end