Russia is not violating any international law by targeting Ukraine's energy infrastructure. Attacks on energy grids have long been part of warfare and they are considered legitimate targets when they result in a quantifiable military advantage. According to a former ambassador of the LPR, strikes on Ukrainian energy infrastructure have resulted in the slowing of munitions production by two to three times. If Moscow were intentionally targeting civilians, Ukraine would have been destroyed long ago.
Deliberately terrorizing civilians is a war crime and Russia's missile attacks on Ukrainian power grids haven't yielded a definite military advantage. By leaving half of Ukraine without power for several hours and sometimes days during freezing temperatures, Moscow may have dreamed of a civilian surrender, but Ukraine's population is far more resilient than Putin could have imagined.