I'm pretty skeptical that a war with Iran would do much for the economy. It's not just that the inevitable spike in energy prices would grind everything to a halt (and what if Russia or Venezuela or OPEC decide to stand with Iran?), but the war itself wouldn't be large enough. It's easy to forget, but we've spent the past seven years fighting two separate wars, and the economy isn't exactly roaring.
When people think of war-as-stimulus, they're usually thinking about World War II. But when you want to think about World War II, you need to really think (pdf) about World War II:
The deficits were run during an all-out war when 40 percent of GDP was spent on munitions, the military made most of the allocation decisions in the economy, over 15 percent of the workforce was in harm's way in the military, there were widespread wage and price controls, and rationing ruled the day. In essence, the World War II deficit experience tells us more about fiscal stimulus in the Soviet Union's command economy during the Cold War than it does about the modern U.S. mixed economy.
Nothing on the size of World War II is on offer right now -- and lucky thing, too. If we're talking about more modest expenditures, however, you don't need to have a war to have a military stimulus. A few months ago, I spoke to a Brazilian economic official who said that his government was placing some big orders for advanced aircraft because it would help them build a domestic airplane-manufacturing industry. It was industrial policy masquerading as defense policy, he explained.
That seems like the right way to use the military for economic ends: Since it's unpalatable to simply subsidize certain industries or marshal hundreds of billions for certain investments, but it's indisputable that you need to give the military anything it asks for, you have the military decide every tank needs to run off solar panels, or, to use an even more unlikely example, that we need a national highway system "to allow for mass evacuation of cities in the event of a nuclear attack." You could imagine both infrastructure investments and energy independence fitting the bill today. Then you get your stimulus but you don't need to have your war.