File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # vim:ts=4:sts=4:sw=4:et
3+ #
4+ # Author: Hari Sekhon
5+ # Date: 2021-05-24 16:34:19 +0100 (Mon, 24 May 2021)
6+ #
7+ # https://github.com/HariSekhon/pytools
8+ #
9+ # License: see accompanying Hari Sekhon LICENSE file
10+ #
11+ # If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
12+ #
13+ # https://www.linkedin.com/in/HariSekhon
14+ #
15+
16+ set -euo pipefail
17+ [ -n " ${DEBUG:- } " ] && set -x
18+ srcdir=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
19+
20+ cd " $srcdir "
21+
22+ name=" proxy"
23+
24+ # gcloud functions deploy doesn't seem to infer CLOUDSDK_COMPUTE_REGION from environment
25+ region=" $( gcloud config list --format=" value(compute.region)" 2>&1 || :) "
26+ region=" ${CLOUDSDK_COMPUTE_REGION:- ${region:- europe-west1} } " # not available in all regions yet
27+
28+ # https://console.cloud.google.com/marketplace/product/google/vpcaccess.googleapis.com
29+ # for serverless VPC access to resources using their Private IPs
30+ # since we're only accessing the SQL Admin API we don't need this
31+ # vpc_connector="my-vpc-connector"
32+
33+ gcloud functions deploy " $name " --trigger-http \
34+ --security-level=secure-always \
35+ --runtime python39 \
36+ --entry-point main \
37+ --memory 128MB \
38+ --region " $region " \
39+ --timeout 60 \
40+ --quiet # don't prompt to --allow-unauthenticated
41+ # routes private traffic only by default - need to change this if you want to
42+ # use the Cloud NAT gateway from the VPC for Firewall rules purposes
43+ # --vpc-connector "$vpc_connector" \
44+ # --max-instances 1
You can’t perform that action at this time.
0 commit comments