Turbulent flows above a solid surface are characterised by a hydrodynamic roughness that represents, for the far velocity field, the typical length scale at which momentum mixing occurs close to the surface. Here, we are theoretically interested in the hydrodynamic roughness induced by a two-dimensional modulated surface, the elevation profile of which is decomposed in Fourier modes. We describe the flow for a sinusoidal mode of given wavelength and amplitude with Reynolds-averaged Navier–Stokes equations closed by means of a mixing-length approach that takes into account a possible surface geometrical roughness as well as the presence of a viscous sublayer. It also incorporates spatial transient effects at the laminar–turbulent transition. Performing a weekly nonlinear expansion in the bedform aspect ratio, we predict the effective hydrodynamic roughness when the surface wavelength is varied and we show that it presents a non-monotonic behaviour at the laminar–turbulent transition when the surface is hydrodynamically smooth. Further, with a self-consistent looped calculation, we are able to recover the smooth–rough transition of a flat surface, for which the hydrodynamic roughness changes from a regime where it is dominated by the viscous length to another one where it scales with the surface corrugation. We finally apply the results to natural patterns resulting from hydrodynamic instabilities such as those associated with dissolution or sediment transport. We discuss in particular the aspect ratio selection of dissolution bedforms and roughness hierarchy in superimposed ripples and dunes.