While I don't agree with Brazil doing exactly what it's doing, Elon is on the wrong on this one.
The law is the law. The Supreme Court has voted unanimously. If he doesn't want to offer service there due to his morals, that's up to him.
Let's be honest, the Steve Bannon connection to Brazil is probably a factor here.