Skip to content

Instantly share code, notes, and snippets.

@mesmacosta
Created October 25, 2020 17:47
Show Gist options
  • Select an option

  • Save mesmacosta/73b604d4a2b3a996f9c2070156d296a7 to your computer and use it in GitHub Desktop.

Select an option

Save mesmacosta/73b604d4a2b3a996f9c2070156d296a7 to your computer and use it in GitHub Desktop.
function upsert_cloud_function() {
local topic_name=$1
local project_id=$2
local project_number=$3
local service_account_name=$4
cat <<EOF >.env.yaml
DATACATALOG_PROJECT_ID: $DATACATALOG_PROJECT_ID
DATACATALOG_PROJECT_NUMBER: "$project_number"
DATACATALOG_LOCATION_ID: $DATACATALOG_LOCATION_ID
DB_CREDENTIALS_USER_SECRET: $DB_CREDENTIALS_USER_SECRET
DB_CREDENTIALS_PASS_SECRET: $DB_CREDENTIALS_PASS_SECRET
POSTGRESQL_SERVER: $POSTGRESQL_SERVER
POSTGRES_DB: $POSTGRES_DB
EOF
gcloud functions deploy gcf-run-postgresql-connector \
--runtime python37 \
--trigger-topic $topic_name \
--project $project_id \
--entry-point sync \
--service-account $service_account_name@$project_id.iam.gserviceaccount.com \
--env-vars-file .env.yaml
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment