A topological theory for Euclidean gravity in eight dimensions can be built by enforcing octonionic self-duality conditions on the spin connection. The eight-dimensional manifold must be of a special type, with G(2) subset of Spin(7) subset of SO(8) holonomy. The resulting theory is related to a twisted version of N = 1, D = 8 supergravity. The situation is comparable to that of the topological Yang-Mills theory in eight dimensions, for which the SO(8) invariance is broken down to Spin(7). but is recovered after untwisting the topological theory.