Let's say I have a Mongo DB instance running on VM in Project A. And I want to connect my Google Cloud Function in Project B to the DB in Project A. What do I need to setup in Console?
I have added Project B's service account to Project A IAM (the one ends with xxx@appspot.gserviceaccount.com) but from GCF's log, mongo keeps reporting error like MongoError: getaddrinfo ENOTFOUND mongodb0-server-1 mongodb0-server-1:27017
I believe I have to allow Project B to access Project A's resources from firewall rules, but I am not sure as Cloud Functions do not have external IP like Compute Engine. Also I couldn't found clear documentation about this case.