Google and PostgreSQL Provider


I am trying to create a GCP Cloud SQL - PostgreSQL instance using the GCP provider and accessing it in the same module using the PostgreSQL provider.

Issue occurs on the PostgreSQL provider when running the module saying the connection was refused. My hypothesis is that the PostgreSQL provider is assuming the instance was already created where in fact it will be created still since both are on the same module.

When running the module commenting the lines of PostgreSQL provider, it will run successfully. Rerunning the same module uncommenting the lines will now proceed and complete successfully since the instance was already created on the first run.

Do you have any idea how can GCP and PostgreSQL providers coexist in the same module?