A cosmodicy is a hand-waving attempt to assert the fundamental goodness of the universe in the face of perceived evil. The term is modelled on theodicy, and is used by those who see cosmodicy and theodicy as being analogous disciplines. A related term is anthropodicy, which describes arguments for the fundamental goodness of humanity in the face of evil.
A number of theologians have grappled with the relationship between cosmodicy and theodicy. Johannes van der Ven argues that the choice between theodicy and cosmodicy is a false dilemma.[1] Philip E. Devenish proposes "a nuanced view in which theodicy and cosmodicy are rendered complementary, rather than alternative concepts."[2] Theologian J. Matthew Ashley describes the relationship between theodicy, cosmodicy and anthropodicy:

“”In classical terms, this is to broach the problem of theodicy: how to think about God in the face of the presence of suffering in God's creation. After God's dethronement as the subject of history, the question rebounds to the new subject of history: the human being. As a consequence, theodicy becomes anthropodicy — justifications of our faith in humanity as the subject of history, in the face of the suffering that is so inextricably woven into the history that humanity makes. Mutatis mutandis, the universe story brings with it the need for a "cosmodicy." How do we think about the presence of suffering, on a massive scale, in the story of the cosmos, particularly when the cosmos itself is understood to be the subject of history? How do we justify our faith in the cosmos?[3]

The answer, of course, is exactly that of theodicy: we don't. As an omnipotent god could not be omnibenevolent, nor should we expect the universe to be. "Faith in the cosmos" and "faith in humanity" are restricted to the prospect that they exist, not that they are deserving of worship, no one but followers of the Abrahamic religions ever having conflated the two. Like an enormous housecat, the cosmos is pretty, good to have around, and sometimes can even appear caring, but ultimately could not give a flying fuck.