Use GetTerrainHeight to find the y value under the legs (assuming you know where the feet are, you'd have to work that bit out first) then when you have all four values work out the angle you would need to sit square with the terrain and use SetRotation to rotate the entity to that angle.
If you look for my truck demo thingy all the code you would need is in there.
But 'relatively simple'? No.
Edited to add: If it is an animated entity then you may have trouble working out where the feet are!
Been there, done that, got all the T-Shirts!