Leaving Iraq and Afghanistan before those nations can manage their own internal security has a significant downside for those nations and ours. That said, those interests can be subordinated to an attack Iran. And I think, if push comes to shove, Iran should be attacked at the expense of security in Iraq and Afghanistan.
Considerations in the equation of a US military strike against Iran are many; i.e. 2006 US election, domestic support, foreign support, Iraq, Afghanistan, the perception of US military might and capability abroad, the need for a military draft, placing the USA on more of a war time footing. Some very tough decisions are being made at this time.
One of the things Bush has done very well is make tough choices without equivocation. If it was presented to him as "Iraq and Afghanistan will be stable but Iran will be nuclear", which may well be the case, I have no doubts what he would do.
A nuclear Iran is unacceptable. They are a dangerous combination of spiteful and crazy.