Skip to content

Commit 38875e1

Browse files
committed
update documentation and IAM policies
1 parent f2d2985 commit 38875e1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

broker/cloud_run/lvk/ps_to_storage/deploy.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ ps_input_subscrip=$(define_GCP_resources "${survey}-alerts_raw") # pub/sub subsc
3737
ps_topic_alerts_in_bucket=$(define_GCP_resources "projects/${PROJECT_ID}/topics/${survey}-alerts_in_bucket")
3838
ps_trigger_topic=$(define_GCP_resources "${survey}-alerts_raw")
3939
runinvoker_svcact="cloud-run-invoker@${PROJECT_ID}.iam.gserviceaccount.com"
40+
service_account="service-${PROJECT_NUMBER}@gcp-sa-pubsub.iam.gserviceaccount.com"
4041

4142
if [ "${teardown}" = "True" ]; then
4243
# ensure that we do not teardown production resources
@@ -56,7 +57,7 @@ if [ "${teardown}" = "True" ]; then
5657
fi
5758
else
5859
echo
59-
echo "Creating gcs_alerts_bucket and setting permissions..."
60+
echo "Creating gcs_alert_bucket, uploading files, and setting permissions..."
6061
if ! gsutil ls -b "gs://${gcs_alerts_bucket}" >/dev/null 2>&1; then
6162
#--- Create the bucket that will store the alerts
6263
gsutil mb -b on -l "${region}" "gs://${gcs_alerts_bucket}"
@@ -72,7 +73,6 @@ else
7273
echo "${gcs_alerts_bucket} already exists."
7374
fi
7475

75-
#--- Setup the Pub/Sub notifications on the JSON storage bucket
7676
echo
7777
echo "Configuring Pub/Sub notifications on GCS bucket..."
7878
trigger_event=OBJECT_FINALIZE
@@ -102,4 +102,7 @@ else
102102
--push-auth-service-account="${runinvoker_svcact}" \
103103
--dead-letter-topic="${ps_deadletter_topic}" \
104104
--max-delivery-attempts=5
105+
gcloud pubsub subscriptions add-iam-policy-binding "${ps_input_subscrip}" \
106+
--member="serviceAccount:${service_account}" \
107+
--role="roles/pubsub.subscriber"
105108
fi

0 commit comments

Comments
 (0)