Skip to content

GCP.Config reference

Source: src/GCP/Config/DeploymentGroup.ts

An Infrastructure Manager deployment group — a DAG of deployment units provisioned together.

Changing deploymentGroupId or location replaces the group. Units, labels, and annotations update in place. Create, patch, and delete are long-running operations.

DeploymentGroup: Creating a Deployment Group

Section titled “DeploymentGroup: Creating a Deployment Group”

Generated name

const group = yield* GCP.Config.DeploymentGroup("App", {
deploymentUnits: [{ id: "network", dependencies: [] }],
});

Explicit id and labels

const group = yield* GCP.Config.DeploymentGroup("App", {
deploymentGroupId: "app-group",
deploymentUnits: [
{ id: "network", dependencies: [] },
{ id: "cluster", dependencies: ["network"] },
],
labels: { env: "prod" },
});

DeploymentGroup: Updating a Deployment Group

Section titled “DeploymentGroup: Updating a Deployment Group”
// Same logical id as before; only the changed props differ.
const group = yield* GCP.Config.DeploymentGroup("App", {
deploymentGroupId: "app-group",
deploymentUnits: [
{ id: "network", dependencies: [] },
{ id: "cluster", dependencies: ["network"] },
{ id: "apps", dependencies: ["cluster"] },
],
labels: { env: "prod", team: "platform" },
});

Source: src/GCP/Config/Preview.ts

An Infrastructure Manager preview — the Terraform plan Infra Manager would apply to reach the desired blueprint (or to delete a deployment).

Previews have no patch API. Changing identity (previewId, location) or any input (blueprint, service account, labels, …) replaces the preview. Create and delete are long-running operations and typically invoke Cloud Build.

Git blueprint

const preview = yield* GCP.Config.Preview("Plan", {
serviceAccount:
"projects/my-project/serviceAccounts/sa@my-project.iam.gserviceaccount.com",
terraformBlueprint: {
gitSource: {
repo: "https://github.com/terraform-google-modules/terraform-docs-samples.git",
directory: "storage/quickstart",
},
},
labels: { env: "test" },
});

Preview against an existing deployment

const preview = yield* GCP.Config.Preview("Plan", {
serviceAccount:
"projects/my-project/serviceAccounts/sa@my-project.iam.gserviceaccount.com",
deployment: existingDeployment,
previewMode: "DEFAULT",
});