Error, attempting to list users associated with instance googleapi: Error 403: The client is not authorized to make this request

My terraform main.tf is as shown below

provider "google-beta" {
  credentials = file("key.json")
  project     = "spatial-cat-319209"
  region      = "asia-south1"
  zone        = "asia-south1-a"
}

data "google_project" "project" {
  provider = google-beta
}

data "google_client_config" "myconfig" {
  provider = google-beta
}

resource "random_id" "suffix" {
  count = 1

  byte_length = 4
}

resource "random_password" "password" {
  length           = 16
  special          = true
  override_special = "_%@"
}

resource "google_sql_database_instance" "master" {
  name             = "master-instance-${random_id.suffix[0].hex}"
  database_version = "SQLSERVER_2017_STANDARD"
  region           = data.google_client_config.myconfig.region
  project = data.google_project.project.number
  root_password    = random_password.password.result
  deletion_protection = false

  settings {
    # Second-generation instance tiers are based on the machine
    # type. See argument reference below.
    tier = "db-custom-2-3840"
  }
}

I get the following error

 Error: Error, attempting to list users associated with instance master-instance-1e474e58: googleapi: Error 403: The client is not authorized to make this request., notAuthorized
│
│   with google_sql_database_instance.master,
│   on main.tf line 28, in resource "google_sql_database_instance" "master":
│   28: resource "google_sql_database_instance" "master" {
│

I have tried creating a new service account and gave owner role. Still getting the same error.

Raised an issue here as well.

The issue seems to specific to MSSQL. I was able to create a postgresql resource without any problems.

What am I missing?

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum