Google Cloud Functions in Go deployed with Go
A minimal Go Pulumi program using Google Cloud Functions.
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-go-functionscd pulumi-examples/gcp-go-functionsThis example deploys a Google Cloud Function implemented in Go. The Pulumi program is also implemented in Go.
Prerequisites#
Deploying the example#
-
Create a new stack, which is an isolated deployment target for this example:
Terminal window pulumi stack init dev -
Set the GCP project and region:
Terminal window pulumi config set gcp:project <gcp-project>pulumi config set gcp:region <gcp-region> -
Install dependencies:
Terminal window go mod download -
Execute the Pulumi program to deploy your function:
Terminal window pulumi up -
Test your function by curl-ing the trigger URL:
Terminal window curl $(pulumi stack output function)"Hello World!" -
From there, feel free to experiment. Simply making edits and running
pulumi upwill incrementally update your function.
Cleaning up#
Once you are done, you can destroy all of the resources, and the stack:
pulumi destroypulumi stack rm