jsalmeron,
Thank you for the pointer, however, I am stuck on the same thing.
First, the MatterMost configuration seems to keep reverting back to the internal IP of the server, rather than chat.foobar.com as I keep entering. Changing the line in /home/bitnami/apps/mattermost/server/config/config.json doesn't seem to change this behavior, either.
But regardless, I'm having the same issue as the GP. I'm running the latest MatterMost build. I was hoping that getting a Let's Encrypt certificate would be as simple as enabling the option in MatterMost, but obviously not so much. So I followed the instructions posted (side note, the 'webroot' option is #3 now), but got the 400 error indicating that the traffic was being redirected to HTTPS. I disabled the option in MatterMost, and also found another website that indicated that the 'ssl on' option in the nginx config would do the same thing. So I commented the line out in /opt/bitnami/nginx/conf/vhosts/mattermost.conf (which also had the internal IP, which I changed to chat.foobar.com, then reverted on the next reboot again...), and then I got another error message...which wasn't the 400 error, but I can't seem to find in the log files and is beyond my terminal buffer and I've used up all of my 'botched attempt at getting a cert' allowances.
If we're able to figure this out, I will be more than happy to personally write the copy/paste tutorial for getting a LetsEncrypt cert for the MatterMost machine.