Wood-boring beetles generate cavities that secondarily serve as critical nesting resources for arboreal ants. Yet despite this dependency, how beetle-produced cavity resources have shaped the evolution of the ant lineages that depend on them is unclear. The turtle ants (Cephalotes) are a diverse lineage of New World arboreal ants that has undergone an adaptive radiation throughout the Neotropics. Known for their iconic phenotypic diversity among ants, the soldier caste has an armored head shield that is used to barricade the entrances of arboreal cavity nests against intruders. Here, I show how work on the turtle ant adaptive radiation has revealed an intimate relationship between the diversity of beetle-produced cavities and the adaptive evolution of soldier morphology. Ecological data show that nest entrance area spans nearly two orders of magnitude across turtle ant species. Comparative analyses demonstrate that four distinct soldier ecomorphs have evolved within the turtle ants to effectively defend entrances of different sizes and variability, and each ecomorph has evolved repeatedly within the lineage. Head size is further shown to evolve by divergent pulses of change, consistent with speciation across different cavity resources. For the two soldier ecomorphs that preferentially select beetle holes that fit one soldier head, four categories of shield shape were identified across species. These shield shapes approximate the diversity of hole shapes create by different wood-boring beetle taxa. Broadly, these finding indicate that one of the most striking social insect adaptive radiations is underpinned by a critical dependency and functional interaction with beetle-produced cavities.