1. Packages
  2. Google Cloud (GCP) Classic
  3. How-to Guides
  4. Google Cloud Functions in Python, Go, and TypeScript Deployed with TypeScript
Google Cloud Classic v7.32.0 published on Tuesday, Jul 16, 2024 by Pulumi

Google Cloud Functions in Python, Go, and TypeScript Deployed with TypeScript

gcp logo
Google Cloud Classic v7.32.0 published on Tuesday, Jul 16, 2024 by Pulumi

    View Code Deploy this example with Pulumi

    This 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 stack
    $ pulumi stack init testing
    $ pulumi config set gcp:project <your-gcp-project>
    $ pulumi config set gcp:region <gcp-region>
    
    # Install dependencies
    $ npm install
    
    # Preview and run the deployment
    $ pulumi up
    Previewing changes:
    ...
    Performing changes:
    ...
    info: 6 changes performed:
        + 6 resources created
    Update duration: 1m14s
    
    # Test it out
    $ curl $(pulumi stack output pythonEndpoint)
    "Hello World!"
    $ curl $(pulumi stack output goEndpoint)
    "Hello World!"
    $ curl $(pulumi stack output tsEndpoint)
    "Hello World!"
    
    # Remove the app
    $ pulumi destroy
    

    TypeScript 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.

    gcp logo
    Google Cloud Classic v7.32.0 published on Tuesday, Jul 16, 2024 by Pulumi