Skip to content

GCP.BackupDR reference

Source: src/GCP/BackupDR/BackupPlan.ts

A Backup and DR backup plan — schedule and retention for a workload type, stored in a Backup Vault.

Changing backupPlanId, location, backupVault, resourceType, or labels replaces the plan. Description, rules, log retention, and workload properties update in place.

const backupRules = [
{
ruleId: "daily",
backupRetentionDays: 7,
standardSchedule: {
recurrenceType: "DAILY",
timeZone: "UTC",
backupWindow: { startHourOfDay: 1, endHourOfDay: 5 },
},
},
];
const plan = yield* GCP.BackupDR.BackupPlan("Nightly", {
backupVault: vault.name,
resourceType: "compute.googleapis.com/Instance",
backupRules,
});
// Same logical id, changed props: the engine updates it in place.
const plan = yield* GCP.BackupDR.BackupPlan("Nightly", {
backupVault: vault.name,
resourceType: "compute.googleapis.com/Instance",
description: "nightly backups v2",
labels: { env: "prod" },
backupRules,
});

Source: src/GCP/BackupDR/BackupPlanAssociation.ts

A Backup and DR backup plan association — applies a Backup Plan to a workload (Compute instance, Cloud SQL, AlloyDB, Filestore, or disk).

Associations have no labels field. Nuke discovers them by following the referenced Backup Plan’s Alchemy ownership labels.

Changing backupPlanAssociationId, location, resource, or resourceType replaces the association. backupPlan updates in place.

BackupPlanAssociation: Creating an Association

Section titled “BackupPlanAssociation: Creating an Association”
const association = yield* GCP.BackupDR.BackupPlanAssociation("VmPlan", {
resource: instance.selfLink,
resourceType: "compute.googleapis.com/Instance",
backupPlan: plan.name,
});

BackupPlanAssociation: Updating an Association

Section titled “BackupPlanAssociation: Updating an Association”
// Same logical id, changed props: the engine updates it in place.
const association = yield* GCP.BackupDR.BackupPlanAssociation("VmPlan", {
resource: instance.selfLink,
resourceType: "compute.googleapis.com/Instance",
backupPlan: otherPlan.name,
});

Source: src/GCP/BackupDR/BackupVault.ts

A Backup and DR backup vault — the storage location for backups created by Backup Plans.

Changing backupVaultId, location, or encryptionConfig replaces the vault. Description, labels, annotations, retention, access restriction, and inheritance update in place.

Generated name

const vault = yield* GCP.BackupDR.BackupVault("Vault", {});

Explicit id, retention, and labels

const vault = yield* GCP.BackupDR.BackupVault("Vault", {
backupVaultId: "app-backups",
backupMinimumEnforcedRetentionDuration: "86400s",
description: "nightly backups",
labels: { env: "prod" },
});
// Same logical id, changed props: the engine updates it in place.
const vault = yield* GCP.BackupDR.BackupVault("Vault", {
description: "nightly backups v2",
labels: { env: "prod", team: "platform" },
});

Source: src/GCP/BackupDR/ManagementServer.ts

A Backup and DR management console (ManagementServer). Provisioning is slow (tens of minutes) and typically limited to one console per region.

There is no patch API — labels, description, type, and networks are set at create. Changing managementServerId, location, type, or networks replaces the server.

ManagementServer: Creating a Management Server

Section titled “ManagementServer: Creating a Management Server”

Generated name, default network

const server = yield* GCP.BackupDR.ManagementServer("Console", {
networks: [{ network: "default", peeringMode: "PRIVATE_SERVICE_ACCESS" }],
});

Explicit id

const server = yield* GCP.BackupDR.ManagementServer("Console", {
managementServerId: "backup-console",
type: "BACKUP_RESTORE",
description: "primary management console",
labels: { env: "prod" },
});