In this paper, we present VLT/SINFONI integral field spectroscopy of RCW 34 along with Spitzer/IRAC photometry of the surroundings. RCW 34 consists of three different regions. A large bubble has been detected in the IRAC images in which a cluster of intermediate-and low-mass class II objects is found. At the northern edge of this bubble, an H ii region is located, ionized by 3 OB stars, of which the most massive star has spectral type O8.5V. Intermediate-mass stars (2-3 M ) are detected of G-and K-spectral type. These stars are still in the premain-sequence (PMS) phase. North of the H ii region, a photon-dominated region is present, marking the edge of a dense molecular cloud traced by H 2 emission. Several class 0/I objects are associated with this cloud, indicating that star formation is still taking place. The distance to RCW 34 is revised to 2.5 ± 0.2 kpc and an age estimate of 2 ± 1 Myr is derived from the properties of the PMS stars inside the H ii region. Between the class II sources in the bubble and the PMS stars in the H ii region, no age difference could be detected with the present data. The presence of the class 0/I sources in the molecular cloud, however, suggests that the objects inside the molecular cloud are significantly younger. The most likely scenario for the formation of the three regions is that star formation propagated from south to north. First the bubble is formed, produced by intermediate-and low-mass stars only, after that, the H ii region is formed from a dense core at the edge of the molecular cloud, resulting in the expansion similar to a champagne flow. More recently, star formation occurred in the rest of the molecular cloud. Two different formation scenarios are possible. (1) The bubble with the cluster of low-and intermediate-mass stars triggered the formation of the O star at the edge of the molecular cloud, which in its turn induces the current star formation in the molecular cloud. (2) An external triggering is responsible for the star formation propagating from south to north.