No, the armed forces have their own fuel locomotives. I imagine any sizeable military does the same thing. Plus most (all?) cargo trains still use fuel. 100% electric is just passenger traffic.
https://www.outono.net/elentir/2021/10/23/the-spanish-army-r...