> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formae.io/llms.txt
> Use this file to discover all available pages before exploring further.

# GCP configuration

> Configure a GCP target for formae: credentials and target settings.

The GCP plugin lets formae manage Google Cloud Platform resources.

## Configuration

### Target

Configure a GCP target in your Forma file:

```kotlin theme={"languages":{"custom":["/languages/pkl.json"]}}
import "@formae/formae.pkl"
import "@gcp/gcp.pkl"

target: formae.Target = new formae.Target {
    label = "gcp-target"
    config = new gcp.Config {
        project = "your-project-id"
        region = "us-central1"
        // Optional: path to service account key file
        // credentialsFile = read("env:GCP_CREDENTIALS_FILE")
    }
}
```

### Credentials

The plugin uses the standard GCP credential chain.

Application Default Credentials (ADC):

```bash theme={"languages":{"custom":["/languages/pkl.json"]}}
gcloud auth application-default login
```

Service Account Key File:

```bash theme={"languages":{"custom":["/languages/pkl.json"]}}
export GCP_CREDENTIALS_FILE="/path/to/service-account-key.json"
```

Then reference it in your target config:

```kotlin theme={"languages":{"custom":["/languages/pkl.json"]}}
config = new gcp.Config {
    project = "your-project-id"
    region = "us-central1"
    credentialsFile = read("env:GCP_CREDENTIALS_FILE")
}
```

Workload Identity (on GKE): when running on GKE with Workload Identity enabled, credentials are provided automatically.

OIDC (for CI/CD): for GitHub Actions, use `google-github-actions/auth` with Workload Identity Federation.

| Environment Variable   | Description                          | Required            |
| ---------------------- | ------------------------------------ | ------------------- |
| `GCP_PROJECT_ID`       | GCP project ID                       | Yes                 |
| `GCP_PROJECT_NUMBER`   | GCP project number                   | For WIF             |
| `GCP_REGION`           | GCP region (e.g., `europe-central2`) | Yes                 |
| `GCP_ZONE`             | GCP zone (e.g., `europe-central2-b`) | For zonal resources |
| `GCP_CREDENTIALS_FILE` | Path to service account JSON key     | Local only          |
