Whenever I have to deploy a new python function using the gcloud
sdk I get this message
Allow unauthenticated invocations of new function [function-name]?
(y/N)?
WARNING: Function created with limited-access IAM policy. To enable unauthorized access consider
"gcloud alpha functions add-iam-policy-binding function-name --region=europe-west1 --member=allUsers --role=roles/cloudfunctions.invoker"
Is there any flag I can add to the command to make it a NO
when deploying?
This is a sample command I use to deploy one function:
gcloud functions deploy function-name --region=europe-west1 --entry-point function-entry-point --trigger-resource "projects/my-project/databases/(default)/documents/user_ids/{user_id}" --trigger-event providers/cloud.firestore/eventTypes/document.create --runtime python37 --timeout 60 --project my-project
From https://cloud.google.com/sdk/docs/scripting-gcloud#disabling_prompts:
You can disable prompts from gcloud CLI commands by setting the
disable_prompts
property in your configuration toTrue
or by using the global--quiet
or-q
flag.
So for your example, you could run:
gcloud functions deploy function-name --quiet --region=europe-west1 --entry-point function-entry-point --trigger-resource "projects/my-project/databases/(default)/documents/user_ids/{user_id}" --trigger-event providers/cloud.firestore/eventTypes/document.create --runtime python37 --timeout 60 --project my-project