Currently, we can manage "Trusted Sources" for Managed PostgreSQL through the web UI, but this cannot be easily automated (perhaps with Selenium).
Please add support for listing, adding, and removing trusted sources via the REST API (and thus also doctl).
Hopefully this will be implemented for Managed Redis and Managed MySQL too when these are available.
Firewall rules for managed databases can now be managed via the API. For more details, see the API changelog entry: https://developers.digitalocean.com/documentation/changelog/api-v2/managed-databases-firewall-and-sql-mode-management/