In superconductors with unconventional pairing mechanisms, the energy gap in the excitation spectrum often has nodes, which allow quasiparticle excitations at low energies. In many cases, such as in d-wave cuprate superconductors, the position and topology of nodes are imposed by the symmetry, and thus the presence of gapless excitations is protected against disorder. Here we report on the observation of distinct changes in the gap structure of iron-pnictide superconductors with increasing impurity scattering. By the successive introduction of nonmagnetic point defects into BaFe2(As(1-x)P(x))(2) crystals via electron irradiation, we find from the low-temperature penetration depth measurements that the nodal state changes to a nodeless state with fully gapped excitations. Moreover, under further irradiation the gapped state evolves into another gapless state, providing bulk evidence of unconventional sign-changing s-wave superconductivity. This demonstrates that the topology of the superconducting gap can be controlled by disorder, which is a strikingly unique feature of iron pnictides.