Both approaches are legitimate and have roots in Orthodox litterateur.
Usually we refrain from interpreting the Torah as only a metaphor (see Rabad on Hilchot Melachim 12:1 and the Mirkavat Mishne there) , while in some cases we most understand the Torah in a metaphorical way (such as Deut. 10:16 "ומלתם את ערלת לבבכם וערפכם לא תקשו עוד"). However, interpreting an entire story is more problematic, and one shouldn't do it unless he finds it impossible to understand the story as it is.
The idea that interpreting certain parts of the Torah as metaphors is more problematic then interpreting prophecies (the dry bones prophecy) or certain books (Job and Shir HaShirim) as metaphors is explained by the Abarbanel in his commentary on Genesis 2:4 he states the main differences are:
Claiming an entire book is a metaphor is easier than saying that certain bits and parts of a book are a metaphor, since then you have to decide which parts are to be taken literally and which not.
Understanding dreams and prophecies as metaphors is easier and less problematic then interpreting stories that are documented and written its actual historical events as metaphors. Because then who can tell when it will stop? what prevents us from saying that King David, the Avot, even the story of the Exodus are metaphors?
This leads the Abarbanel to claim that even when the Rambam interpreted certain stories as metaphors, he did it only when he found it absolutely necessary. It should be pointed out that the Rambams interpretation of the story of Sodom as a prophecy or a dream, as he did with every story that involves angels, was not viewed as legitimate by all of the Rishonim. The Ramban even went as far as claiming (Gen. 18:1) that it is forbidden to read or believe in such ideas.
Nevertheless, the Rambams view is a legitimate Jewish view, which many Orthodox rabbis and sages have taken.
The bottom line is that if you understand the story literally you will learn a lot and will benefit, and if you want you can look at our different Rabbis interpretations to the story and learn as well.
אלה ואלה דברי אלוהים חיים
If you want, here is an article by (my grandfather, so I'm not exactly objective ;)) Rabbi Schubert Spero on the subject: The Biblical Stories of Creation, Garden of Eden and the Flood: History or Metaphor? - Shubert Spero