>Instead of targeting data centers, it's far easier to target the electrical substation that powers the datacenter
That has a lot of collateral damage that may or may not be desirable though. Simultaneously it might have quite a different long term effect right? If all the actual computers are unharmed they can be powered in other ways in an emergency, even if at much higher cost. Or powered back up later, the time lost might be militarily very significant but they're not gone.
But how many people and companies actually have full functional decentralized clones of all programs and data? How many people and companies have devices that are locked to remote hosts they expect to check in on at least once in awhile even if they're not "cloud dependent"? What if all that was literally gone, a few thousand missiles or drones and data centers are all just completely erased including tape backups, everything, suddenly we're in a world where all that compute and data is poof. And without hurting anything else, no traditional war crimes either, no power or direct food or transport disruptions. Everyone is fine and healthy, except with this huge societal exocortex gone.
Any cloud engineer worth their salt is going to have their programs be stateless and their data replicated across multiple data centers. Many cloud engineers are not worth their salt, but working in Big Tech, this has been table stakes for 20+ years. There are regular disaster drills, both scheduled and unscheduled, that test what happens when a datacenter disappears. Ideally everything transparently fails over, and most of the time, this is what happens.
The bigger problem is that a war is likely to hit multiple levels of infrastructure at the same time. So the datacenters will come under attack, but so will the fiber cables, and the switching apparatuses, and the power plants, and likely also the humans who maintain it all. High-availability software is usually designed for 1-2 components to fail at once and then to transparently route around them. If large chunks of the infrastructure all disappear at once, you can end up in some very weird cascading failure situations.