File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,16 +34,20 @@ region="${CLOUDSDK_COMPUTE_REGION:-${region:-europe-west1}}"
3434# since we're only accessing the SQL Admin API we don't need this
3535# vpc_connector="my-vpc-connector"
3636
37+ opts=()
38+ if [ -n " ${vpc_connector:- } " ]; then
39+ # routes all traffic through VPC connector to re-use the VPC's Cloud NAT IP eg. for permitting in firewall rules
40+ opts+=(--vpc-connector " $vpc_connector " --egress-settings all)
41+ fi
42+
43+ set -x
3744gcloud functions deploy " $name " --trigger-http \
3845 --security-level=secure-always \
3946 --runtime python39 \
4047 --entry-point main \
4148 --memory 128MB \
4249 --region " $region " \
4350 --timeout 60 \
51+ " ${opts[@]} " \
4452 --quiet # don't prompt to --allow-unauthenticated
45- # routes private traffic only by default - need to change this if you want to
46- # use the Cloud NAT gateway from the VPC for Firewall rules purposes
47- # --vpc-connector "$vpc_connector" \
48- # --egress-settings all # sends all traffic through connector to exit via network's Cloud NAT IP
4953 # --max-instances 1
You can’t perform that action at this time.
0 commit comments