If we attack Iran, the Iran-allied government of Iraq will be in dire straits. First, the Supreme Council for the Islamic Revolution in Iraq, the Iranian-backed party which in large part, runs Iraq, will be torn. The U.S. provides its security, but Iran is its main financial backer and arms its militia.
While it hesitates, al Sadr will move in. He will take a strong anti-American position, and gain the adherence of most Iraqi Shia. Then he will attack using his Mahdi Army. We'll be attacked by both sides and no one will want us there. Even worse, the Iranians could just simply allow their Revolutionary Guard to walk over the border in civilian clothes to wreak all sorts of havoc.
Don't say you weren't warned.