Let $K$ be a connected compact Lie group. The moduli space of flat $K$-connections over an $n$-torus is homeomorphic to the character variety $Hom(\mathbb{Z}^n,K)/K$. The identity component of this space is homeomorphic to $T^n/W$ where $T$ is a maximal torus in $K$ and $W$ is the Weyl group (generalizing the example you gave when $K=SU(m)$). The moduli space is connected iff $n=1$, or $n=2$ and $K$ is simply connected, or $n\geq 3$ and $K$ is isomorphic to a product of $SU(m)$'s and/or $Sp(k)$'s. Replacing $K$ with a complex reductive group $G$, we have a similar, although more complicated story. Please see my paper: *[Topology of character varieties of Abelian groups][1]* (co-authored with C. Florentino) for details about that case (and references for the above mentioned facts). [1]: https://arxiv.org/abs/1301.7616