Google Cloud Functions in Python, Go, and TypeScript Deployed with TypeScript
Basic example of a serverless GCP functions in TypeScript, Python and Go
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-ts-serverless-rawcd pulumi-examples/gcp-ts-serverless-rawThis example deploys three Google Cloud Functions. “Hello World” functions are implemented in Python, Go, and TypeScript. Pulumi program is implemented in TypeScript.
# Create and configure a new stackpulumi stack init testingpulumi config set gcp:project <your-gcp-project>pulumi config set gcp:region <gcp-region>
# Install dependenciesnpm install
# Preview and run the deploymentpulumi upPreviewing changes:...Performing changes:...info: 6 changes performed: + 6 resources createdUpdate duration: 1m14s
# Test it outcurl $(pulumi stack output pythonEndpoint)"Hello World!"curl $(pulumi stack output goEndpoint)"Hello World!"curl $(pulumi stack output tsEndpoint)"Hello World!"
# Remove the apppulumi destroyTypeScript Notes#
In the typescriptfunc folder you’ll notice more than a function. Some configuration is needed to inform GCP how to build TypeScript for the Node.js runtime environment. See this example from Google for more details.
Related
TemplateGoogle Cloud
Google Cloud Serverless Application
TemplateAWS