If $f$ is analytic then $|f|$ is not constant unless $f$ is constant

Suppose that $|f|\equiv k$ for some $k\in[0,+\infty)$.

  1. If $k=0$, then $f\equiv0$.
  2. Otherwise, the image of $f$ is contained in the circle centered at $0$ with radius $k$. Such a set contains no open non-empty subset of $\mathbb C$. But, if $f$ was not constant, then by the open mapping theorem, its image would be an open (and obviously non-empty) subset of $\mathbb C$.

Observe that $|f|^2=u^2+v^2$, where $f(x,y)=u(x,y)+iv(x,y)$. If $|f(z)|^2=0$ for some $z \in \Omega$, we are done. Therefore consider $|f|^2 \neq 0$. Differeniate $|f|^2$ with respect to $x$ and $y$. Since $|f|^2$ is constant, we get by Cauchy-Riemann that $$ 0=2uu_x+2vv_x=2uu_x-2vu_y $$ $$ 0=2uu_y+2vv_y=2 u u_y+2vu_x $$ Rewriting it in matrix form with the matrix $M$ gives: $$ 2 \begin{bmatrix} u & -v \\ v & u \end{bmatrix} \begin{bmatrix} u_x \\ u_y \end{bmatrix}= \begin{bmatrix} 0 \\ 0 \end{bmatrix} $$ Then, observe that $det(M)=|f|^2\neq0$. There, in order for the linear equation system to be statisfied, it is required that $u_x=u_y=0$. Therefore, $Re(f)$ is constant. Therefore $f$ is constant.