Let Y be a Ornstein–Uhlenbeck diffusion governed by astationary and ergodic process X : dYt = a(Xt)Yt dt + σ(Xt)dWt,Y0 = y0 . We establish that under the condition α = Eµ(a(X0)) < 0 with μ the stationary distribution of the regime process X, the diffusion Y is ergodic. We also consider conditions for the existence of moments for theinvariant law of Y when X is a Markov jump process having a finite number of states.Using results on random difference equationson one hand and the fact that conditionally toX, Y is Gaussian on the other hand, we give such a condition for the existence of the moment of order s ≥ 0. Actually we recover in this case a result that Basak et al. [J. Math. Anal. Appl. 202 (1996) 604–622] have established using the theory of stochastic control of linear systems.