You know the drill. You deploy a lightning-fast edge function, only to realize it still needs an API key that can’t live in your repo. Security says, “Use Secret Manager.” Infra says, “But we’re on Fastly.” The good news is that Fastly Compute@Edge and GCP Secret Manager actually make a great team once you stop treating them like strangers.
Fastly Compute@Edge runs lightweight code close to users. It handles requests in under a millisecond, without waiting for a centralized backend. GCP Secret Manager stores and manages sensitive values like tokens, encryption keys, or OAuth credentials with strong identity and access controls. When you connect them properly, your Fastly service pulls secrets just-in-time, without leaving credentials exposed in your deploy pipeline.
The magic depends on identity. You configure Fastly to fetch secrets from GCP using a service account identity that has been granted access to specific keys. Fastly’s runtime authenticates outbound calls using workload identity federation, so there is no static credential stored anywhere. The call passes through IAM, verifies the token, and returns the needed secret. The Compute@Edge function can then inject the secret into memory, use it, and drop it immediately after the response.
To set up the integration, define your GCP Secret Manager policies first. Map service accounts to secrets using IAM permissions like roles/secretmanager.secretAccessor. Next, in Fastly, ensure your deployment uses environment variables or metadata that reference the service account identity. The connection flow looks like this: request from the edge → identity assertion via OIDC → GCP verification → one-time secret retrieval → response sent. All verified, all transient.
A few best practices smooth the ride:
- Rotate secrets with short TTLs so nothing stale persists at the edge.
- Enforce RBAC boundaries that limit one service identity per environment.
- Log audit trails in GCP for every access event.
- Never cache secrets manually inside Compute@Edge memory snapshots.
This integration pays off quickly: