I have a DB server running as a Compute Engine VM, and an API running on Cloud Run. Both are part of the same project. I want the DB VM to only be accessible from the Cloud Run code.
At first I thought this should just work because the firewall has a "default-allow-internal" rule that should apply to every machine in the project. However I was still getting connection failures.
Then I tried adding a new ingress rule that targeted the service account and allowed connections from the service account. This also didn't work.
I modified the rule to allow connections from my personal IP just to confirm the DB VM was working and my firewall rules worked, and everything worked as expected.
Finally I looked into filtering by "source tag" but the option was not selectable and I couldn't seem to be able to add source tags to the Cloud Run instance.
Is it possible for me to achieve my goal of restricting access to the DB VM to only allow incoming connections from the Cloud Run machine?