class Overcommit::Hook::PreCommit::TerraformFormat

Runs 'terraform fmt' against any modified *.tf files.

@see www.terraform.io/docs/commands/fmt.html

Public Instance Methods

run() click to toggle source
# File lib/overcommit/hook/pre_commit/terraform_format.rb, line 8
def run
  messages = []
  applicable_files.each do |f|
    result = execute(command, args: [f])
    unless result.success?
      messages << Overcommit::Hook::Message.new(:error, f, nil, "violation found in #{f}")
    end
  end
  messages
end