Attacking the Qirya, Israel's HQ, with some sort of accuracy is a legitimate military target. It's a pretty large target. Soldiers wear uniform. There are no civilians mixed into that camp.
This is very different than lobbing rockets at Beer-Sheba, Ashdod, Ashkelon, Ramat Gan. The casualties from Iran's attacks, minus one off-duty soldier, were all civilians and the targets were nowhere near anything military. The intentionally aim at population centers.