---
title: "Google Cloud Functions in Go deployed with Go"
description: "A minimal Go Pulumi program using Google Cloud Functions."
url: "https://www.pulumi.com/dev/examples/gcp-go-functions/"
image: "https://www.pulumi.com/assets/og/dev/examples/gcp-go-functions.png"
---

# Google Cloud Functions in Go deployed with Go

A minimal Go Pulumi program using Google Cloud Functions.

- Source on GitHub: https://github.com/pulumi/examples/tree/master/gcp-go-functions

## Get started with this example

This example lives in the [pulumi/examples](https://github.com/pulumi/examples/tree/master/gcp-go-functions) repo. Pull down just this directory to follow along:

```bash
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set gcp-go-functions
cd pulumi-examples/gcp-go-functions
```

This example deploys a Google Cloud Function implemented in Go. Pulumi program is also implemented in Go.

## Deploying the App

To deploy your infrastructure, follow the below steps.

### Prerequisites

1. [Install Pulumi](https://www.pulumi.com/docs/get-started/install/)
1. [Configure Pulumi for GCP](https://www.pulumi.com/docs/intro/cloud-providers/gcp/setup/)
    - [Set up a Service Account](https://www.pulumi.com/docs/intro/cloud-providers/gcp/service-account/)

### Steps

1.  Create a new stack:

    ```
    $ pulumi stack init dev
    ```

1. Set the GCP project and region:

    ```bash
    pulumi config set gcp:project <gcp-project>
    pulumi config set gcp:region <gcp-region>
    ```

1. Execute the Pulumi program to deploy our function:

    ```bash
    pulumi up
    ```

1. Test our function by curl-ing the trigger URL.

    ```bash
    curl $(pulumi stack output function)
    # "Hello World!"
    ```

1. From there, feel free to experiment. Simply making edits and running `pulumi up` will incrementally update your function.

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

    ```bash
    pulumi destroy --yes
    pulumi stack rm --yes
    ```
