Under a sane president there would be a pretty clear off ramp available in the form of a negotiated settlement. Iran stops attacking neighbors and the strait in exchange for a US promise to not start another unprovoked war, along with another JCPOA type agreement lifting sanctions and limiting their nuclear development. The problem here is that absolutely nobody trusts trump to actually stick to a deal, especially after he was the one who broke the previous deal and then attacked them twice in the middle of negotiations. Trump's stupidity compounds the mess in ways that no other president would.

Without a negotiating partner Iran basically has to settle the issue with force. They are going to try to do as much economic damage as possible in order to deter current and future attacks, or die trying. Without a ground invasion the attacks on both sides will wind down at some point but it's hard to see how we get to a clean cease fire, it's likely to be a messy uneven one that could flare back up at any point.