The more likely scenario at the moment is the reverse of your question. In a sense, the response would be less complicated if Iran attacks Israel than if Israel attacks Iran. If Israel is attacked, the U.S. will be obligated to provide military assistance to Israel. But if Israel attacks first, it will be a tricky situation. Given the low standing of the U.S. in that part of the world, aiding Israeli "aggression" will not help American public relations. The U.S. will have to hope that an Israeli strike cripples Iran's nuclear program (somehow) without the need for heavy American intervention. Then Israel, who will be hated in that part of the world no matter what, can take the heat.
Whatever the circumstances that start it, a conflict between Iran and Israel will be bad news all around. It could have major economic implications, and if Israel and/or the United States put troops on the ground in Iran and seek some sort of a regime change, it could make Iraq look like a cakewalk in comparison.