Google Cloud Functions in Python deployed with C

View Code Deploy

This example deploys a Google Cloud Function implemented in Python. Pulumi program is implemented in C#.

Deploying the App

To deploy your infrastructure, follow the below steps.

Prerequisites

  1. Install Pulumi
  2. Configure Pulumi for GCP
  3. Install .NET Core 3.0+

Deploying and running the program

  1. Create a new stack:

    $ pulumi stack init dev
    
  2. Set the GCP project and region:

    $ pulumi config set gcp:project <your-gcp-project>
    $ pulumi config set gcp:region <gcp-region>
    
  3. Run pulumi up to preview and deploy changes:

    $ pulumi up
    Previewing changes:
    ...
    
    Performing changes:
    ...
    info: 10 changes performed:
        + 10 resources created
    Update duration: 45s
    
  4. Check the deployed function endpoints:

    $ pulumi stack output PythonEndpoint
    https://us-central1-test-1234.cloudfunctions.net/python-func-742a512
    $ curl "$(pulumi stack output PythonEndpoint)"
    Hello World!
    
  5. From there, feel free to experiment. Simply making edits and running pulumi up will incrementally update your stack.

  6. Once you’ve finished experimenting, tear down your stack’s resources by destroying and removing it:

    $ pulumi destroy --yes
    $ pulumi stack rm --yes