File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,14 @@ set -o errexit
6
6
IAM_NAME=" ${GCEPD_SA_NAME} @${PROJECT} .iam.gserviceaccount.com"
7
7
8
8
# Cleanup old Service Account and Key
9
- rm -f " ${SA_FILE} "
10
- gcloud iam service-accounts delete " ${IAM_NAME} " --quiet
9
+ if [ -f $SA_FILE ]; then
10
+ rm " $SA_FILE "
11
+ fi
12
+ gcloud iam service-accounts delete " $IAM_NAME " --quiet || true
11
13
# TODO: Delete ALL policy bindings
12
14
13
15
# Create new Service Account and Keys
14
16
gcloud iam service-accounts create " ${GCEPD_SA_NAME} "
15
17
gcloud iam service-accounts keys create " ${SA_FILE} " --iam-account " ${IAM_NAME} "
16
- gcloud projects add-iam-policy-binding " ${PROJECT} " --member serviceAccount:" ${IAM_NAME} " --role roles/compute.storageAdmin
18
+ gcloud projects add-iam-policy-binding " ${PROJECT} " --member serviceAccount:" ${IAM_NAME} " --role roles/compute.admin
19
+ gcloud projects add-iam-policy-binding " ${PROJECT} " --member serviceAccount:" ${IAM_NAME} " --role roles/iam.serviceAccountUser
You can’t perform that action at this time.
0 commit comments