The main thing is to ensure your Steam Profile is set to "public" It cannot read your game library data to see if you own Terraria if it's not set to public.
When that condition is meet, it can take time for the trophy to be rewarded, but once it is rewarded, you can set your Steam Profile back to Private if that's what you have it set as.