I'm using a GCP Service Account from project A to provision resources to project B.
I'm providing the GOOGLE_APPLICATION_CREDENTIALS environment variable to the google and postgresql providers for authentication.
Within the google provider config I can use the project and user_project_override parameters to instruct the provider to
ignore the project of the service account. Unfortunately there are no such options for the postgresql provider while using the gcppostgres schema.
What happens now is the postgresql provider seems to check if the sqladmin.googleapis.com API is enabled for the origin project of the GCP Service Account, instead of checking the origin project of the CloudSQL database and I'm getting the following error:
googleapi: Error 403: Cloud SQL Admin API has not been used in project XXXX before or it is disabled. Enable
it by visiting https://console.developers.google.com/apis/api/sqladmin.googleapis.com/overview?project=XXXX
then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems
and retry.
If I'm enabling the Cloud SQL Admin API for the origin project of the Service account, the error goes away ...
I'm using a GCP Service Account from project A to provision resources to project B.
I'm providing the
GOOGLE_APPLICATION_CREDENTIALS
environment variable to the google and postgresql providers for authentication.Within the google provider config I can use the
project
anduser_project_override
parameters to instruct the provider to ignore the project of the service account. Unfortunately there are no such options for the postgresql provider while using thegcppostgres
schema.What happens now is the postgresql provider seems to check if the
sqladmin.googleapis.com
API is enabled for the origin project of the GCP Service Account, instead of checking the origin project of the CloudSQL database and I'm getting the following error:If I'm enabling the
Cloud SQL Admin API
for the origin project of the Service account, the error goes away ...Terraform Version
Affected Resource(s)
Terraform Configuration Files