module Ruby::Terraform::ExecutionSupport
Public Instance Methods
execute(opts = {})
click to toggle source
# File lib/ruby/terraform/execution_support.rb, line 7 def execute(opts = {}) working_dir = opts[:dir] || (self.dir if self.respond_to?(:dir)) shellout_opts = {} shellout_opts[:cwd] = working_dir if working_dir if opts[:live] shellout_opts[:live_stdout] = STDOUT shellout_opts[:live_stderr] = STDERR end if opts[:show_command] formatter = proc do |severity, datetime, progname, msg| "#{msg}\n" end logger = Logger.new(STDERR, formatter: formatter) shellout_opts[:logger] = logger logger.info("Running command inside directory: #{shellout_opts[:cwd]}") if shellout_opts[:cwd] end cmd = Mixlib::ShellOut.new(command, shellout_opts) cmd.run_command cmd.error! end
tf_binary()
click to toggle source
# File lib/ruby/terraform/execution_support.rb, line 31 def tf_binary executable = Executable.new executable.download executable.extract executable.binary end