I know Germany was short on resources and material before Operation Barbarossa because the world was against them by then and cut exports to them, but who enabled the Nazi war machine to be built in the first place and why?
Going as far back as the Weimar Republic, the German government and military had collaborated with the Soviet Union to allow German officers to train on new equipment (particularly aircraft, tanks, and chemical warfare agents) in exchange for training Red Army officers in tactics. The reason they could do this without being discovered is that the USSR was not a party to the Treaty of Versailles, as the Western powers had deliberately excluded the Bolsheviks from sending a representative and the Soviets were all too willing to help Germany as a way to thumb their nose at the West.
As for where the resources and material came from, Germany was able to supply much of it on its own. Despite the effect of World War I and the Great Depression on the German economy, the Ruhr valley was still home to one of the largest industrial regions in Europe, full of coal and iron mines and all the factories one might need to produce raw material. In fact, the French occupied the Ruhr from 1923-24 when Germany refused to keep up with reparations payments and the resulting shutdown of many factories (by Germany as a form of passive resistance) had a disastrous effect on the German economy, so the heavy industry in the Ruhr was still very much still able to produce anything Germany might need. Furthermore, German universities and technical schools had been churning out all of the scientists, engineers, and designers needed to turn that raw material into weapons of war.
Finally, Germany paid for the rearmament program on their own, with the idea being that they could use it to end unemployment in the country (which it did within a few years) and a fully employed workforce would then kick-start the economy and raise tax revenues higher than they had been. This also had the effect of solidifying the Nazis' political power as they were seen as the saviors of the German economy.
The other part of your question is who allowed Germany's rearmament to happen. The answer is: no one. Initially, Germany's rearmament was carried out in secret. But in October 1933 Germany officially withdrew from the League of Nations, and when Italy did so in 1936 (they had been condemned for invading Ethiopia) Germany and Italy grew closer diplomatically to the point where Germany felt comfortable rearming in the open. The US and USSR were firmly isolationist, and Britain and France (the two strongest nations opposing Germany and Italy) were unable and unwilling to start another European war. Both nations had reduced military spending during the Depression and weren't confident they were well-matched against Germany and Italy, plus the memory of the Great War was all too fresh.
Source: Gerhard Weinberg, A World at Arms: a Global History of World War II