In my humble opinion? Sunshine. Why? There are several cannabinoids produced the by marijuana plant - THC (or trans-tetrahydrocannabinol) being the most recognizable.
There is another cannabinoid acll THVC (or tetrahydrocannabivarin) is the compound associated with fragrance (and taste) of the plant. Pungent smelling varieties are very high in THVC.
It is a well known fact that heat increases production of THVC, increasing the level of smell as temperature rises.
Not so well known, and in fact is only my theory in so far as I know, is that THVC production is also increased by natural sunlight. Artificial lighting works too of course, but not nearly as well (due to the limited light spectrum).
But there is no doubting the fact that my plants grown outside in my own dirt taste differently than plants grown indoors (even plants grown by licensed, collective growers). My theory is that dirt alone does not account for the taste difference.
Here's a technique for adding flavor that I learned from an old hippy in NOCAL. He told me its the ONLY thing that really works - and only IF its done correctly.
After cessation of fertilization and flushing period, drought the plant in total darkness for 24-48 hours. The plant will go into stress believing it is about to die - and therefore entirely focus on seed production. Resin explodes and buds swell.
About 1 hour before harvest, add a super-concentrated gallon of lemon flavoring mixed with filtered water (or mint, vanilla, etc.). The stressed and drought-ed planted will suck up all of the flavoring in a final desperate attempt at staying alive.
Harvest and cure as normal. The lemony (or other flavor) is unmistakable.