@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
548 lines • 18.2 kB
JavaScript
"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BackupPlan = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Represents a Backup Plan instance.
*
* To get more information about BackupPlan, see:
*
* * [API documentation](https://cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke/reference/rest/v1/projects.locations.backupPlans)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke)
*
* ## Example Usage
*
* ### Gkebackup Backupplan Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const primary = new gcp.container.Cluster("primary", {
* name: "basic-cluster",
* location: "us-central1",
* initialNodeCount: 1,
* workloadIdentityConfig: {
* workloadPool: "my-project-name.svc.id.goog",
* },
* addonsConfig: {
* gkeBackupAgentConfig: {
* enabled: true,
* },
* },
* deletionProtection: true,
* network: "default",
* subnetwork: "default",
* });
* const basic = new gcp.gkebackup.BackupPlan("basic", {
* name: "basic-plan",
* cluster: primary.id,
* location: "us-central1",
* backupConfig: {
* includeVolumeData: true,
* includeSecrets: true,
* allNamespaces: true,
* },
* });
* ```
* ### Gkebackup Backupplan Autopilot
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const primary = new gcp.container.Cluster("primary", {
* name: "autopilot-cluster",
* location: "us-central1",
* enableAutopilot: true,
* ipAllocationPolicy: {},
* releaseChannel: {
* channel: "RAPID",
* },
* addonsConfig: {
* gkeBackupAgentConfig: {
* enabled: true,
* },
* },
* deletionProtection: true,
* network: "default",
* subnetwork: "default",
* });
* const autopilot = new gcp.gkebackup.BackupPlan("autopilot", {
* name: "autopilot-plan",
* cluster: primary.id,
* location: "us-central1",
* backupConfig: {
* includeVolumeData: true,
* includeSecrets: true,
* allNamespaces: true,
* },
* });
* ```
* ### Gkebackup Backupplan Cmek
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const primary = new gcp.container.Cluster("primary", {
* name: "cmek-cluster",
* location: "us-central1",
* initialNodeCount: 1,
* workloadIdentityConfig: {
* workloadPool: "my-project-name.svc.id.goog",
* },
* addonsConfig: {
* gkeBackupAgentConfig: {
* enabled: true,
* },
* },
* deletionProtection: true,
* network: "default",
* subnetwork: "default",
* });
* const keyRing = new gcp.kms.KeyRing("key_ring", {
* name: "backup-key",
* location: "us-central1",
* });
* const cryptoKey = new gcp.kms.CryptoKey("crypto_key", {
* name: "backup-key",
* keyRing: keyRing.id,
* });
* const cmek = new gcp.gkebackup.BackupPlan("cmek", {
* name: "cmek-plan",
* cluster: primary.id,
* location: "us-central1",
* backupConfig: {
* includeVolumeData: true,
* includeSecrets: true,
* selectedNamespaces: {
* namespaces: [
* "default",
* "test",
* ],
* },
* encryptionKey: {
* gcpKmsEncryptionKey: cryptoKey.id,
* },
* },
* });
* ```
* ### Gkebackup Backupplan Nslabels
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const primary = new gcp.container.Cluster("primary", {
* name: "nslabels-cluster",
* location: "us-central1",
* initialNodeCount: 1,
* workloadIdentityConfig: {
* workloadPool: "my-project-name.svc.id.goog",
* },
* addonsConfig: {
* gkeBackupAgentConfig: {
* enabled: true,
* },
* },
* deletionProtection: true,
* network: "default",
* subnetwork: "default",
* });
* const nslabels = new gcp.gkebackup.BackupPlan("nslabels", {
* name: "nslabels-plan",
* cluster: primary.id,
* location: "us-central1",
* backupConfig: {
* includeVolumeData: true,
* includeSecrets: true,
* selectedNamespaceLabels: {
* resourceLabels: [{
* key: "key1",
* value: "value1",
* }],
* },
* },
* });
* ```
* ### Gkebackup Backupplan Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const primary = new gcp.container.Cluster("primary", {
* name: "full-cluster",
* location: "us-central1",
* initialNodeCount: 1,
* workloadIdentityConfig: {
* workloadPool: "my-project-name.svc.id.goog",
* },
* addonsConfig: {
* gkeBackupAgentConfig: {
* enabled: true,
* },
* },
* deletionProtection: true,
* network: "default",
* subnetwork: "default",
* });
* const full = new gcp.gkebackup.BackupPlan("full", {
* name: "full-plan",
* cluster: primary.id,
* location: "us-central1",
* retentionPolicy: {
* backupDeleteLockDays: 30,
* backupRetainDays: 180,
* },
* backupSchedule: {
* cronSchedule: "0 9 * * 1",
* },
* backupConfig: {
* includeVolumeData: true,
* includeSecrets: true,
* selectedApplications: {
* namespacedNames: [
* {
* name: "app1",
* namespace: "ns1",
* },
* {
* name: "app2",
* namespace: "ns2",
* },
* ],
* },
* },
* });
* ```
* ### Gkebackup Backupplan Permissive
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const primary = new gcp.container.Cluster("primary", {
* name: "permissive-cluster",
* location: "us-central1",
* initialNodeCount: 1,
* workloadIdentityConfig: {
* workloadPool: "my-project-name.svc.id.goog",
* },
* addonsConfig: {
* gkeBackupAgentConfig: {
* enabled: true,
* },
* },
* deletionProtection: true,
* network: "default",
* subnetwork: "default",
* });
* const permissive = new gcp.gkebackup.BackupPlan("permissive", {
* name: "permissive-plan",
* cluster: primary.id,
* location: "us-central1",
* retentionPolicy: {
* backupDeleteLockDays: 30,
* backupRetainDays: 180,
* },
* backupSchedule: {
* cronSchedule: "0 9 * * 1",
* },
* backupConfig: {
* includeVolumeData: true,
* includeSecrets: true,
* permissiveMode: true,
* selectedApplications: {
* namespacedNames: [
* {
* name: "app1",
* namespace: "ns1",
* },
* {
* name: "app2",
* namespace: "ns2",
* },
* ],
* },
* },
* });
* ```
* ### Gkebackup Backupplan Rpo Daily Window
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const primary = new gcp.container.Cluster("primary", {
* name: "rpo-daily-cluster",
* location: "us-central1",
* initialNodeCount: 1,
* workloadIdentityConfig: {
* workloadPool: "my-project-name.svc.id.goog",
* },
* addonsConfig: {
* gkeBackupAgentConfig: {
* enabled: true,
* },
* },
* deletionProtection: true,
* network: "default",
* subnetwork: "default",
* });
* const rpoDailyWindow = new gcp.gkebackup.BackupPlan("rpo_daily_window", {
* name: "rpo-daily-window",
* cluster: primary.id,
* location: "us-central1",
* retentionPolicy: {
* backupDeleteLockDays: 30,
* backupRetainDays: 180,
* },
* backupSchedule: {
* paused: true,
* rpoConfig: {
* targetRpoMinutes: 1440,
* exclusionWindows: [
* {
* startTime: {
* hours: 12,
* },
* duration: "7200s",
* daily: true,
* },
* {
* startTime: {
* hours: 8,
* minutes: 40,
* seconds: 1,
* nanos: 100,
* },
* duration: "3600s",
* singleOccurrenceDate: {
* year: 2024,
* month: 3,
* day: 16,
* },
* },
* ],
* },
* },
* backupConfig: {
* includeVolumeData: true,
* includeSecrets: true,
* allNamespaces: true,
* },
* });
* ```
* ### Gkebackup Backupplan Rpo Weekly Window
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const primary = new gcp.container.Cluster("primary", {
* name: "rpo-weekly-cluster",
* location: "us-central1",
* initialNodeCount: 1,
* workloadIdentityConfig: {
* workloadPool: "my-project-name.svc.id.goog",
* },
* addonsConfig: {
* gkeBackupAgentConfig: {
* enabled: true,
* },
* },
* deletionProtection: true,
* network: "default",
* subnetwork: "default",
* });
* const rpoWeeklyWindow = new gcp.gkebackup.BackupPlan("rpo_weekly_window", {
* name: "rpo-weekly-window",
* cluster: primary.id,
* location: "us-central1",
* retentionPolicy: {
* backupDeleteLockDays: 30,
* backupRetainDays: 180,
* },
* backupSchedule: {
* paused: true,
* rpoConfig: {
* targetRpoMinutes: 1440,
* exclusionWindows: [
* {
* startTime: {
* hours: 1,
* minutes: 23,
* },
* duration: "1800s",
* daysOfWeek: {
* daysOfWeeks: [
* "MONDAY",
* "THURSDAY",
* ],
* },
* },
* {
* startTime: {
* hours: 12,
* },
* duration: "3600s",
* singleOccurrenceDate: {
* year: 2024,
* month: 3,
* day: 17,
* },
* },
* {
* startTime: {
* hours: 8,
* minutes: 40,
* },
* duration: "600s",
* singleOccurrenceDate: {
* year: 2024,
* month: 3,
* day: 18,
* },
* },
* ],
* },
* },
* backupConfig: {
* includeVolumeData: true,
* includeSecrets: true,
* allNamespaces: true,
* },
* });
* ```
*
* ## Import
*
* BackupPlan can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/backupPlans/{{name}}`
* * `{{project}}/{{location}}/{{name}}`
* * `{{location}}/{{name}}`
*
* When using the `pulumi import` command, BackupPlan can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:gkebackup/backupPlan:BackupPlan default projects/{{project}}/locations/{{location}}/backupPlans/{{name}}
* $ pulumi import gcp:gkebackup/backupPlan:BackupPlan default {{project}}/{{location}}/{{name}}
* $ pulumi import gcp:gkebackup/backupPlan:BackupPlan default {{location}}/{{name}}
* ```
*/
class BackupPlan extends pulumi.CustomResource {
/**
* Get an existing BackupPlan resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new BackupPlan(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:gkebackup/backupPlan:BackupPlan';
/**
* Returns true if the given object is an instance of BackupPlan. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === BackupPlan.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["backupConfig"] = state?.backupConfig;
resourceInputs["backupSchedule"] = state?.backupSchedule;
resourceInputs["cluster"] = state?.cluster;
resourceInputs["deactivated"] = state?.deactivated;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["description"] = state?.description;
resourceInputs["effectiveLabels"] = state?.effectiveLabels;
resourceInputs["etag"] = state?.etag;
resourceInputs["labels"] = state?.labels;
resourceInputs["location"] = state?.location;
resourceInputs["name"] = state?.name;
resourceInputs["project"] = state?.project;
resourceInputs["protectedNamespaceCount"] = state?.protectedNamespaceCount;
resourceInputs["protectedPodCount"] = state?.protectedPodCount;
resourceInputs["pulumiLabels"] = state?.pulumiLabels;
resourceInputs["retentionPolicy"] = state?.retentionPolicy;
resourceInputs["state"] = state?.state;
resourceInputs["stateReason"] = state?.stateReason;
resourceInputs["uid"] = state?.uid;
}
else {
const args = argsOrState;
if (args?.cluster === undefined && !opts.urn) {
throw new Error("Missing required property 'cluster'");
}
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
resourceInputs["backupConfig"] = args?.backupConfig;
resourceInputs["backupSchedule"] = args?.backupSchedule;
resourceInputs["cluster"] = args?.cluster;
resourceInputs["deactivated"] = args?.deactivated;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["description"] = args?.description;
resourceInputs["labels"] = args?.labels;
resourceInputs["location"] = args?.location;
resourceInputs["name"] = args?.name;
resourceInputs["project"] = args?.project;
resourceInputs["retentionPolicy"] = args?.retentionPolicy;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["etag"] = undefined /*out*/;
resourceInputs["protectedNamespaceCount"] = undefined /*out*/;
resourceInputs["protectedPodCount"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
resourceInputs["stateReason"] = undefined /*out*/;
resourceInputs["uid"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(BackupPlan.__pulumiType, name, resourceInputs, opts);
}
}
exports.BackupPlan = BackupPlan;
//# sourceMappingURL=backupPlan.js.map