Skip to content

Commit d705850

Browse files
committed
updated deploy.sh
1 parent 131bf5c commit d705850

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

gcp_cloud_function_proxy/deploy.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff 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
3744
gcloud 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

0 commit comments

Comments
 (0)