Class: Kitchen::Terraform::ShellOut
- Inherits:
-
Object
- Object
- Kitchen::Terraform::ShellOut
- Defined in:
- lib/kitchen/terraform/shell_out.rb
Overview
Terraform commands are run by shelling out and using the command-line interface. The shell out environment includes the TF_IN_AUTOMATION environment variable as specified by the Running Terraform in Automation guide.
Instance Method Summary collapse
-
#initialize(command:, logger:, options:) ⇒ Kitchen::Terraform::CommandExecutor
constructor
#initialize prepares a new instance of the class.
-
#run {|standard_output| ... } ⇒ self
#run executes a command.
Constructor Details
#initialize(command:, logger:, options:) ⇒ Kitchen::Terraform::CommandExecutor
#initialize prepares a new instance of the class.
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/kitchen/terraform/shell_out.rb', line 33 def initialize(command:, logger:, options:) self.command = command self.logger = logger self.shell_out = ::Mixlib::ShellOut.new( command, .merge( environment: { "LC_ALL" => nil, "TF_IN_AUTOMATION" => "true", "TF_WARN_OUTPUT_ERRORS" => "1" }, live_stream: logger, ) ) end |
Instance Method Details
#run {|standard_output| ... } ⇒ self
#run executes a command.
50 51 52 53 54 55 56 |
# File 'lib/kitchen/terraform/shell_out.rb', line 50 def run execute_workflow yield standard_output: shell_out.stdout self end |