@@ -235,7 +235,7 @@ WIF_POOL_ID=$(gcloud iam workload-identity-pools describe "${POOL_NAME}" \
235235 --location=" ${GOOGLE_CLOUD_LOCATION} " \
236236 --format=" value(name)" )
237237
238- # Step 2 : Create Workload Identity Provider
238+ # Step 3 : Create Workload Identity Provider
239239print_header " Step 2: Creating Workload Identity Provider"
240240ATTRIBUTE_CONDITION=" assertion.repository_owner == '${REPO_OWNER} '"
241241
257257 print_success " Workload Identity Provider already exists"
258258fi
259259
260- # Step 3 : Grant required permissions to the Workload Identity Pool
260+ # Step 4 : Grant required permissions to the Workload Identity Pool
261261print_header " Step 3: Granting required permissions to Workload Identity Pool"
262262PRINCIPAL_SET=" principalSet://iam.googleapis.com/${WIF_POOL_ID} /attribute.repository/${GITHUB_REPO} "
263263
@@ -316,11 +316,40 @@ gcloud projects add-iam-policy-binding "${GOOGLE_CLOUD_PROJECT}" \
316316
317317# Allow the service account to generate an access tokens
318318print_info " Granting 'Service Account Token Creator' role to Service Account..."
319+
319320gcloud projects add-iam-policy-binding " ${GOOGLE_CLOUD_PROJECT} " \
320321 --role=" roles/iam.serviceAccountTokenCreator" \
321322 --member=" serviceAccount:${SERVICE_ACCOUNT_EMAIL} " \
322323 --condition=None
323324
325+ # Grant logging permissions to the service account
326+ print_info " Granting 'Logging Writer' role to Service Account..."
327+ gcloud projects add-iam-policy-binding " ${GOOGLE_CLOUD_PROJECT} " \
328+ --role=" roles/logging.logWriter" \
329+ --member=" serviceAccount:${SERVICE_ACCOUNT_EMAIL} " \
330+ --condition=None
331+
332+ # Grant monitoring permissions to the service account
333+ print_info " Granting 'Monitoring Editor' role to Service Account..."
334+ gcloud projects add-iam-policy-binding " ${GOOGLE_CLOUD_PROJECT} " \
335+ --role=" roles/monitoring.editor" \
336+ --member=" serviceAccount:${SERVICE_ACCOUNT_EMAIL} " \
337+ --condition=None
338+
339+ # Grant tracing permissions to the service account
340+ print_info " Granting 'Cloud Trace Agent' role to Service Account..."
341+ gcloud projects add-iam-policy-binding " ${GOOGLE_CLOUD_PROJECT} " \
342+ --role=" roles/cloudtrace.agent" \
343+ --member=" serviceAccount:${SERVICE_ACCOUNT_EMAIL} " \
344+ --condition=None
345+
346+ # Grant Vertex AI permissions to the service account
347+ print_info " Granting 'Vertex AI User' role to Service Account..."
348+ gcloud projects add-iam-policy-binding " ${GOOGLE_CLOUD_PROJECT} " \
349+ --role=" roles/aiplatform.user" \
350+ --member=" serviceAccount:${SERVICE_ACCOUNT_EMAIL} " \
351+ --condition=None
352+
324353# Allow the Workload Identity Pool to impersonate the Service Account
325354print_info " Allowing GitHub Actions from '${GITHUB_REPO} ' to impersonate the Service Account..."
326355gcloud iam service-accounts add-iam-policy-binding " ${SERVICE_ACCOUNT_EMAIL} " \
0 commit comments