Google Cloud Functions in Python and Go
Basic example of a serverless Python and Go GCP functions (in Python)
This example lives in the pulumi/examples repository. Check out just this directory to use it:
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examplesgit -C pulumi-examples sparse-checkout set gcp-py-serverless-rawcd pulumi-examples/gcp-py-serverless-rawThis example deploys two Google Cloud Functions. “Hello World” functions are implemented in Python and Go. The Pulumi program is implemented in Python.
Prerequisites#
Deploying the example#
-
Create a new stack:
Terminal window pulumi stack init dev -
Configure the project:
Terminal window pulumi config set gcp:project <your-gcp-project>pulumi config set gcp:region <gcp-region> -
Install dependencies:
Terminal window python3 -m venv venvsource venv/bin/activatepip install -r requirements.txt -
Preview and deploy changes:
Terminal window pulumi upinfo: 6 changes performed:+ 6 resources createdUpdate duration: 1m14s -
Test it out:
Terminal window curl $(pulumi stack output python_endpoint)curl $(pulumi stack output go_endpoint)"Hello World!"
Cleaning up#
Once you’re finished experimenting, destroy your stack and remove it:
pulumi destroypulumi stack rmRelated
TemplateGoogle Cloud
Google Cloud Serverless Application
TemplateAWS