class Pronto::TerraformFormat::Wrapper
Public Class Methods
new()
click to toggle source
# File lib/pronto/terraform_format/wrapper.rb, line 9 def initialize @terraform_path = ENV['PRONTO_TERRAFORM_PATH'] || 'terraform' end
Public Instance Methods
run(file_path)
click to toggle source
# File lib/pronto/terraform_format/wrapper.rb, line 13 def run(file_path) stdout, stderr, = Open3.capture3("#{@terraform_path} "\ 'fmt '\ '-write=false '\ '-list=false '\ '-diff=true '\ '-check=false '\ "#{file_path}") if stderr && !stderr.empty? puts "WARN: pronto-terraform_format: #{file_path}: #{stderr}" end return [] if stdout.nil? || stdout == 0 OutputParser.new.parse(file_path, stdout) end