     msg.send {room: msg.message.user.name}, projname
 
     exec "cd #{basepath}/#{projname}; terraform #{action}", (error, stdout, stderr) ->
-      if error
-        msg.send {room: msg.message.user.name}, "Error: #{error}"
       if stderr
+        stderr.replace /\[[^\s]+m/, ''
         msg.send {room: msg.message.user.name}, "stderr:\n```\n#{stderr}\n```"
+      else if error
+        msg.send {room: msg.message.user.name}, "error:\n```\n#{error}\n```"
       if stdout
         msg.send {room: msg.message.user.name}, "stdout:\n```\n#{stdout}\n```"

    fp = basepath + "/hubot-tf"

    exec "GIT_SSH_COMMAND='ssh -i #{privatekey} -F /dev/null -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' git clone #{url} #{projpath}", (error, stdout, stderr) ->
      if error
        msg.send {room: msg.message.user.name}, "Error: #{error}"
      if stderr
        msg.send {room: msg.message.user.name}, "stderr:\n```\n#{stderr}\n```"
      if stdout
        msg.send {room: msg.message.user.name}, "stdout:\n```\n#{stdout}\n```"



    return msg.send {room: msg.message.user.name}, dir.join "\n"

  robot.respond /tf (plan|refresh|apply|get|destroy) ([^\s]+)$/i, (msg) ->
    unless robot.auth.isAdmin(msg.envelope.user) or robot.auth.hasRole(msg.envelope.user,tfRole)
      return msg.send {room: msg.message.user.name}, "Not authorized.  Missing #{tfRole} role."

