Monday, October 11, 2021

ERROR: (gcloud.iam.service-accounts.keys.create) FAILED_PRECONDITION: Precondition check failed.

When you try to create a key for a service account in google cloud via the gcloud iam service-accounts keys create command, it can occur that you receive this error ERROR: (gcloud.iam.service-accounts.keys.create) FAILED_PRECONDITION: Precondition check failed.

Unfortunally searching for this error does not show up much, and adding --verbosity=debug does not turn up more information.

The reason for this error is, that a single service account can have a maximum of (currently) 10 active keys.

If you try to create one more, then you will receive the above error message.

The only way to work arround the problem is to remove older keys, which are (hopefully) no longer used.

You can do this either via the gui or the gcloud iam service-accounts keys delete command

 

Found the solution thanks to https://gist.github.com/maelvls/c23558b717422c4c648f4258a7f2fb1 since in the google documentation there is no reference to a limit on the number of keys per service account

No comments:

Post a Comment