> For the complete documentation index, see [llms.txt](https://docs.tonic.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tonic.ai/fabricate/workspaces/gcp-service-accounts/gcp-google-cloud-id-provider.md).

# Using Google Cloud as the identity provider

When you use Google Cloud as the identity provider, Fabricate's service account impersonates the service account.

## Complete the Fabricate configuration

After you provide the service account email, to complete the configuration:

<figure><img src="https://4109733485-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmoU4gTR9LxlzHeWmQCUZ%2Fuploads%2F1dwai2QBtRH0tIP8G1zL%2FWorkspace_GCPServiceAccountGoogleCloud.png?alt=media&amp;token=0e0cc809-451c-420d-961d-b9f429c784b1" alt=""><figcaption></figcaption></figure>

1. In the **Service Account Description** field, provide the description for the service account.\
   \
   The description is in the format `fabricate:<workspace identifier>`, and is provided in the instructions at the bottom of the panel.\
   \
   Copy this value to use in the GCP configuration.
2. In the **Fabricate's Service Account Email** field, provide the email address of the account that impersonates the service account.\
   \
   Copy this value to use in the GCP configuration.

## Allow Fabricate to impersonate the service account

Next, in GCP, enable Fabricate to impersonate the service account.

### Grant the Fabricate access to the service account

1. Click **☰ → IAM & Admin → Service Accounts**, then click the service account email address for the service account.
2. Open the **Permissions** tab, then click **Grant access**.
3. In the **New principals** field, paste the Fabricate service account email address that you copied from Fabricate.
4. Click **Select a role**, type `Service Account Token Creator`, then select it.\
   \
   This role allows Fabricate to impersonate the account.
5. Click **+ Add another role**, type `Service Account Viewer`, then select it.\
   \
   This role allows Fabricate to read the description.
6. Click **Save**.

### Bind the service account to your workspace

1. On the service account, open the **Details** tab.
2. In the **Description** field, add the service account description text that you copied from Fabricate (`fabricate:<workspace id>`). This ensures that no other workspace can impersonate this service account.\
   \
   The identifier can appear anywhere in the text.\
   \
   A single service account can list several workspaces, for example `fabricate:<id one>, fabricate:<id two>`. However, Google limits the description to 256 bytes.
3. Click **Save changes**.

## Establishing a Fabricate identity on a self-hosted instance

Fabricate needs its own Google identity.&#x20;

To establish a Google identity, first, In **Google Cloud**:

1. In the project that will own Fabricate's identity, enable the **IAM API** and the **IAM Service Account Credentials API**.
2. Create a service account there, for example `fabricate@my-project.iam.gserviceaccount.com`.

After you complete that configuration, based on where Fabricate is hosted, complete one of the following options.

## Attached service account (GCP → GCP)

Use this option if self-hosted Fabricate runs in Google Cloud:

1. Attach the service account to the VM (or node pool, or use Workload Identity on GKE) with the `cloud-platform` access scope.
2. Leave `FABRICATE_GCP_IMPERSONATOR_KEY` unset.\
   \
   Fabricate reads the account's email from the metadata server.
3. Optionally, if the dialog does not display it, set `FABRICATE_GCP_IMPERSONATOR_EMAIL` to the account's email address.
4. Restart Fabricate.

### External account (AWS → GCP)

Use this option if self-hosted Fabricate runs in AWS Cloud:

1. In **IAM & Admin → Workload Identity Federation**, click **Create pool.**
2. Add an **AWS** provider with the AWS account identifier that runs Fabricate.
3. On the service account, grant the pool's principal for the instance's IAM role **Workload Identity User**.
4. Generate the config with `gcloud iam workload-identity-pools create-cred-config ... --aws`.
5. Paste its JSON into `FABRICATE_GCP_IMPERSONATOR_KEY`.
6. Set `FABRICATE_GCP_IMPERSONATOR_EMAIL` to the service account's email address.
7. Restart Fabricate.

### Service account JSON key (any cloud provider → GCP)

Optionally, you can use this option with any other cloud providers not listed above:

1. In **IAM & Admin → Service Accounts**, open the service account.
2. Choose **Keys → Add key → Create new key → JSON**.
3. For the web and worker containers, set the entire file content as a single-line quoted value of the environment variable `FABRICATE_GCP_IMPERSONATOR_KEY`:\
   \
   `FABRICATE_GCP_IMPERSONATOR_KEY='{"type":"service_account","project_id":"...","private_key":"-----BEGIN PRIVATE KEY-----\n...","client_email":"fabricate@my-project.iam.gserviceaccount.com",...}'`
4. Restart Fabricate.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.tonic.ai/fabricate/workspaces/gcp-service-accounts/gcp-google-cloud-id-provider.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
