There is no reference to external Postgresql db configuration in MAAS 3.1 docs and the --database-uri option referenced here apparently doesn’t apply for the above mentioned reason (maas init doesn’t support it).
ah. looks like there is massive inconsistency between MAAS 3.1 snap and apt packages. the documentation above, ostensibly for the apt package, seems to be a clone of the snap package docs but the apt package is completely different.
this is the help from the snap package for maas init:
maas init --help
usage: maas init [-h] {region+rack,region,rack} ...
Initialise MAAS in the specified run mode.
optional arguments:
-h, --help show this help message and exit
run modes:
{region+rack,region,rack}
region+rack Both region and rack controllers
region Region controller only
rack Rack controller only
When installing region or rack+region modes, MAAS needs a
PostgreSQL database to connect to.
If you want to set up PostgreSQL for a non-production deployment on
this machine, and configure it for use with MAAS, you can install
the maas-test-db snap before running 'maas init':
sudo snap install maas-test-db
sudo maas init region+rack --database-uri maas-test-db:///