Search code examples
automationdevopsgoogle-cloud-iamgoogle-cloud-ops-agent

Accidentally deleted all IAM users, now getting permission error while creating private service connection with GCP


I have accidentally deleted all IAM users while applying the google_project_iam_binding resource of terraform. I have now recovered all the users.

Now, I want to create a private service connection with GCP to assign the private IP to CloudSQL. But I am getting the below error.

We encountered a problem while creating a connection. Required 'compute.globalAddresses.list' permission for 'projects/XXXXXX' Help Token:XXXXXXX

I have enabled/disabled all the services, IAM users having the owner access.

[email protected] has the editor access as well.

I got the below error while creating the private connection:

enter image description here


Solution

  • Can you check if you still have the service account, "service-(your-project-number)@service-networking.iam.gserviceaccount.com" from IAM & Admin > Service accounts?

    If not, then its possible that it has been deleted. You can recreate this service account by following the steps below:

    A. Navigate to IAM & Admin > Service Accounts in the GCP console.
    B. Create the default account ‘service-(your-project-number)@service-networking.iam.gserviceaccount.com’ and assign the role ‘servicenetworking.serviceAgent’ by filtering and selecting ‘Service Networking Service Agent’ in the dropdown to select a role.
    C. Once created, try to setup a private service connection again.

    Or you may try to undelete the deleted service account by following this documentation