0

I am trying to create a Cloud SQL PostgreSQL instance using Terraform. I am using a Service Account as credentials for Google, and I have assigned the Cloud SQL Admin role to the Service Account. I am quite lost with the error message I am receiving. Any idea if I need to add other rules to my Service Account?

google_sql_database_instance.postgres_instance: Creating...

 Error: Error, failed to create instance postgresql-dev: googleapi: Error 403: The client is not authorized to make this request., notAuthorized

   with google_sql_database_instance.postgres_instance,
   on main.tf line 402, in resource "google_sql_database_instance" "postgres_instance":
  402: resource "google_sql_database_instance" "postgres_instance" {

I tried to add the Owner rule and I am getting the same error message.

2
  • Are you executing terraform locally with the SA? Are you sure you are impersonating the SA or are you using your SA? Have you checked the logs for that action on Log Explorer? Commented Jan 8 at 22:40
  • 1
    @MrThompson, it was a misconfiguration issue with Terraform. I had a value for master_instance_name set, but I was creating an instance without replicas. By removing this value, the issue was resolved. Commented Jan 9 at 11:33

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.