Skip to content

Commit

Permalink
add permissions for functions service account
Browse files Browse the repository at this point in the history
  • Loading branch information
mdunker committed Aug 16, 2024
1 parent aa3f06c commit da8a942
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ gcloud spanner instances create quiz-instance --config=regional-us-central1 --de
gcloud spanner databases create quiz-database --instance quiz-instance --ddl "CREATE TABLE Feedback ( feedbackId STRING(100) NOT NULL, email STRING(100), quiz STRING(20), feedback STRING(MAX), rating INT64, score FLOAT64, timestamp INT64 ) PRIMARY KEY (feedbackId); CREATE TABLE Answers (answerId STRING(100) NOT NULL, id INT64, email STRING(60), quiz STRING(20), answer INT64, correct INT64, timestamp INT64) PRIMARY KEY (answerId DESC);"

echo "Creating Cloud Functions"
gcloud functions deploy process-feedback --runtime nodejs20 --trigger-topic feedback --source ./functions/feedback --stage-bucket $GCLOUD_BUCKET --entry-point subscribe --retry
gcloud functions deploy process-answer --runtime nodejs20 --trigger-topic answers --source ./functions/answer --stage-bucket $GCLOUD_BUCKET --entry-point subscribe --retry
PROJECT_NUMBER="$(gcloud projects describe ${GCLOUD_PROJECT} --format='get(projectNumber)')"
gcloud projects add-iam-policy-binding ${GCLOUD_PROJECT} \
--member=serviceAccount:${PROJECT_NUMBER}[email protected] \
--role=roles/artifactregistry.reader
gcloud functions deploy process-feedback --runtime nodejs20 --trigger-topic feedback --source ./functions/feedback --stage-bucket $GCLOUD_BUCKET --entry-point subscribe
gcloud functions deploy process-answer --runtime nodejs20 --trigger-topic answers --source ./functions/answer --stage-bucket $GCLOUD_BUCKET --entry-point subscribe

echo "Project ID: $GCLOUD_PROJECT"

0 comments on commit da8a942

Please sign in to comment.