To be fair to the military leadership, they didn't think the attack was a good idea to begin with for this exact reason.
ShipwreckA senior officer in US Central Command’s (CENTCOM) intelligence branch emailed a broad group of military analysts seeking “new creative and unconventional ways to pressure and punish Iran.” A second source indicated a similar request went out the prior week.