Skip to main content

Overview

This guide covers deploying SGP in a GCP project using the SGP GCP Terraform modules. SGP GCP infrastructure is defined by terraform modules managed by Scale.
SGP is deployed jointly with Scale engineering. Scale provides everything under “The following from Scale” in Prerequisites and stays involved for upgrades and ongoing operation. Contact your Scale team before you start.
GCP deployment separates the bootstrap identity from the Terraform execution identity:
  • projectsetup/ — Run once with privileged GCP credentials. Creates a dedicated Terraform service account with broad project administration roles, enables required GCP APIs, and provisions Artifact Registries for SGP images and Helm charts.
  • deployments/<your-deployment>/ — Run with the service account created above. Provisions the GKE cluster, Cloud SQL, networking, and all SGP infrastructure.
The execution identity still has broad privileges, including roles/compute.admin, roles/container.admin, roles/cloudsql.admin, roles/secretmanager.admin, roles/resourcemanager.projectIamAdmin, roles/iam.serviceAccountKeyAdmin, roles/artifactregistry.admin, and roles/storage.admin. Review the complete role list in the provided projectsetup/main.tf before granting access.

Prerequisites

  • Access to a GCP project with permissions to manage IAM, APIs, and compute resources
  • The following tools installed:
  • The following from Scale:
    • The SGP GCP Infrastructure modules (gcp/)
    • A workspace_id (8-digit number) and registration_secret unique to your deployment
  • A new application configured in your identity provider to authenticate to the SGP platform (SAML or OIDC) (optional)
  • A custom domain for your deployment (optional)

Installation

Step 1: Bootstrap the Project

Navigate to the projectsetup/ directory. This phase creates the Terraform service account and Artifact Registries. Edit the locals block at the top of projectsetup/main.tf:
Then initialize and apply:
This creates:
  • A Terraform service account (sgp-tf-lp-<service_account_name>) with the IAM roles needed to provision SGP infrastructure
  • A service account key stored as terraform-service-account-key-secret-2 in Secret Manager
  • Docker and Helm Artifact Registries (sgp-<workspace_id>-docker-repository, sgp-<workspace_id>-helm-repository)
  • All required GCP APIs enabled on the project
The Terraform outputs include the service_account_email of the newly created service account, which is useful for auditing. The project bootstrap stores the key in terraform-service-account-key-secret-2. Before initializing your copied deployment, set the service-account-private-key data source to read that secret:
Terraform then reads the key from Secret Manager, so you don’t need a local key file.

Step 2: Copy SGP Images and Helm Charts

This step is only required if your deployment is configured to block internet access from the cluster (offline_mode in step 3). Before provisioning the main infrastructure, copy SGP’s Docker images and Helm charts from Scale’s registry into your GCP Artifact Registry. Download the manifest from Scale’s control plane:
Note: sgpctl manifest download requires internet access to https://control.egp.scale.com, so it must be run from a connected machine. Users with air-gapped operator workstations should run it from their laptop and SCP the output to wherever they’ll run the mirror commands. Authenticate to source + destination registries:
Mirror images and charts:
Verify the mirror:

Step 3: Configure the Deployment

Copy the deployments/prototype/ directory and rename it for your deployment:
Edit the locals block at the top of main.tf. After you set the secret name in Step 1, the deployment reads its Terraform service account credentials from Secret Manager; no key file is required on disk.
Don’t change aes256EncryptionKey on a running deployment: data encrypted with the old key becomes unreadable. If using SAML, place your IdP’s x509 certificate (without BEGIN/END lines) as x509.cer in the deployment directory. Update the samlConfigSecret in the module "sgp" block:
If using OIDC, update oidcConfigSecret instead:

Desired State

The desired_state.json file in your deployment directory defines which SGP packs System Manager installs. terraform apply copies it into the System Manager configuration, and System Manager reads it only on first install, while its desired state is empty. Finish it, including the certificate setting from Step 4, before you run Terraform in Step 5. After the first install, editing the local file has no effect; update the live desired state in the System Manager GUI, API, or Secret Manager instead, then install the affected packs. Update the file to reference your GCP Artifact Registry:
The gcp block above uses a preshared certificate. Step 4 covers that option and the other two.

Step 4: Configure SSL Certificates

The options are listed in order of preference. Choose one before you run Terraform in Step 5: For each option, edit the existing sgp-base entry and preserve its other properties. When you switch certificate options, replace the existing presharedCertificates list instead of adding to it. Before switching to a managed certificate, make sure every presharedCertificates list in your configuration is empty. Set both flags in main.tf, and add an output for the DNS authorization record, which the prototype doesn’t export. Terraform passes the certificate map to the sgp-base pack:
After terraform apply in Step 5, run terraform output certificate_manager_dns_auth_record and add that CNAME to your DNS zone for domain validation. The certificate typically provisions within 10–60 minutes of the DNS record being in place. Terraform passes the Gateway API setting and certificate-map name to the sgp-base pack as defaults, and desired-state value_overrides take precedence over them. If you set overrides explicitly, merge the following gcp values into the existing sgp-base entry, preserving its other properties, and install that pack. A certificate map requires the Gateway template:

Option 2: Google Managed Certificate

Google provisions the certificates after DNS resolves to the load balancer IP in Step 7. This is the traditional GCE Ingress default when gcp.gatewayApi.enabled is false and presharedCertificates is empty. To switch from another certificate option, merge these values into the existing sgp-base entry and install the pack:
Place this object under properties.helm-base.value_overrides, preserving the entry’s other properties. These values override the Gateway settings that Terraform provides. Make sure every presharedCertificates list in your configuration is empty. Omitting a key does not clear a Terraform-provided default.

Option 3: Preshared Certificate

Upload the certificate:
For traditional GCE Ingress, merge these values into the existing sgp-base entry, keeping its other properties. Before the first install, edit desired_state.json; after it, edit the live desired state. These values disable Gateway API and select the preshared certificate:
Preshared certificates must be renewed manually. Let’s Encrypt certificates expire after 90 days.
Edits to desired_state.json after the first install have no effect. To change the SSL configuration then:
  • Edit the sgp-base pack’s value overrides in the System Manager GUI or API. An API update replaces the pack’s whole helm-base object, so send all of its value overrides, including refreshRegcred.
  • To move to Option 1, also set its two flags in main.tf and run terraform apply.
Then explicitly install sgp-base in the System Manager GUI to apply the change. With the default startup configuration, restarting System Manager also applies the live state by reinstalling all packs:

Step 5: Provision Infrastructure via Terraform

From the deployment directory, initialize and apply:
This step can take 30–60 minutes due to GKE cluster provisioning and Cloud SQL setup. After apply completes, connect to the cluster:
If gke_config.private_endpoint = true, the cluster API server is only accessible from within the VPC. Use the bastion host (via IAP, as one of the bastion_iap_members from Step 3) or a network-connected runner to access it.

Step 6: Bootstrap the Cluster

SGP System Manager orchestrates SGP service deployment. If you set deploy_system_manager = false in Step 3, bootstrap it manually using the provided script. Edit manual-helm-install.sh in your deployment directory with the correct values:
Then run the bootstrap script:
This installs System Manager into the cluster. On its first start, System Manager deploys the packs listed in desired_state.json. Startup installation is enabled by default, so each startup installs all packs in the live desired state. If startup installation is disabled, install the packs in the System Manager GUI. See System Manager configuration for the chart-version requirement.

Step 7: Configure DNS

Get the external IP address of the load balancer:
Create DNS A records in your DNS provider pointing to this IP for:
  • <deployment_url> (apex)
  • api.<deployment_url>
  • auth.<deployment_url>
  • app.<deployment_url>
If createDNSRecords = true in your main.tf locals, Terraform manages a Cloud DNS zone and creates these records automatically. Retrieve the name servers from the Terraform output:
Then delegate the zone by configuring these as NS records at your domain registrar.

Step 8: Verify the Deployment

Wait for all services to be ready:
System Manager renders installed packs into HelmReleases, which Flux then reconciles. After you change the desired state, install the affected packs to apply it. If a HelmRelease shows Ready=False, check its events:

Accessing the Platform

Once all HelmReleases are ready and DNS resolves correctly, navigate to https://<workspace_id>.workspace.egp.scale.com (or your custom domain) and authenticate via your configured identity provider.