In my opinion there is no difference between "perfect terrain" and "ideal terrain". Maybe there are nouns for which you can make a distinction, but in that case both answers should be accepted.
The problem is that perfect is the ideal ideal. We define perfection as something that does not really exist. And something that is ideal theoretically matches our concept of what is perfect. But since we have already discounted perfection as impossible, ideal does take on a somewhat lesser status as we have conceded that perfection is impossible. But ideal and perfecto are great cognates of ideal and perfect. This means that this discussion of to what extent ideal and perfect are synonymous could be duplicated by native Spanish speakers about ideal and perfecto. There are virtually no perfect synonyms within one language. As synonymous words emerge over time they assume different shades of meaning to distinguish themselves. So once you have found a great word to translate to, you are almost always going to have people disagreeing about other choices. This course is really about the broad strokes. If native speakers disagree as to whether words are synonymous, we won't be able to figure it out here.
"Ideal" implies something that is best for an understood use or function, not necessarily something that is perfect. Perfection implies an unparalleled level of "good." There is overlap in the meanings, but a perfect work of art, for example, is different than an ideal work of art, in that it may be the ideal size for an installation or for getting its message across, or it is ideal for a certain buyer due to budget constraints, whereas a perfect piece of art would be flawlessly crafted, masterfully placed and in any way that matters it could be pushed no further in its execution. I suspect that in Spanish the same nuances of meaning are present.
That's not always true. If I say "these shoes are perfect", I don't mean that they are the finest shoes that anyone could possibly make - I mean that they are perfect for me, for my current needs. In that context it means exactly the same as "ideal".
"The ideal terrain" would mean ideal for a particular set of needs - and in that sense, "the perfect terrain" would mean exactly the same, and should be accepted.
"These shoes are perfect", although often used actually probably means the wrong choice of word. After reading Ernesto's and I B's It's very clear in my mind. Often for 'words' that don't have a definite 'standard' "perfect" is not an adequate adjective. Whereas "ideal" it means it serves best its purpose... It's quite tricky as "perfection" is really for idealists!
Thinking more about it I feel through time "ideal" has lost its "perfect" original meaning and has become "optimum". Even with this alternative word for which I can see in the list of its synonyms, there is only one that is for me the 'ideal' translation and it is "most favourable" ... Whilst I did this search I think I could have done at least a couple of 'tree' exercises! I wonder which would have been the most beneficial?