import * as pulumi from "@pulumi/pulumi"; import * as inputs from "../types/input"; import * as outputs from "../types/output"; /** * Represents a Restore Plan instance. * * To get more information about RestorePlan, see: * * * [API documentation](https://cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke/reference/rest/v1/projects.locations.restorePlans) * * How-to Guides * * [Official Documentation](https://cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke) * * ## Example Usage * * ### Gkebackup Restoreplan All Namespaces * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.container.Cluster("primary", { * name: "restore-all-ns-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: "restore-all-ns", * cluster: primary.id, * location: "us-central1", * backupConfig: { * includeVolumeData: true, * includeSecrets: true, * allNamespaces: true, * }, * }); * const allNs = new gcp.gkebackup.RestorePlan("all_ns", { * name: "restore-all-ns", * location: "us-central1", * backupPlan: basic.id, * cluster: primary.id, * restoreConfig: { * allNamespaces: true, * namespacedResourceRestoreMode: "FAIL_ON_CONFLICT", * volumeDataRestorePolicy: "RESTORE_VOLUME_DATA_FROM_BACKUP", * clusterResourceRestoreScope: { * allGroupKinds: true, * }, * clusterResourceConflictPolicy: "USE_EXISTING_VERSION", * }, * }); * ``` * ### Gkebackup Restoreplan Rollback Namespace * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.container.Cluster("primary", { * name: "rollback-ns-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: "rollback-ns", * cluster: primary.id, * location: "us-central1", * backupConfig: { * includeVolumeData: true, * includeSecrets: true, * allNamespaces: true, * }, * }); * const rollbackNs = new gcp.gkebackup.RestorePlan("rollback_ns", { * name: "rollback-ns-rp", * location: "us-central1", * backupPlan: basic.id, * cluster: primary.id, * restoreConfig: { * selectedNamespaces: { * namespaces: ["my-ns"], * }, * namespacedResourceRestoreMode: "DELETE_AND_RESTORE", * volumeDataRestorePolicy: "RESTORE_VOLUME_DATA_FROM_BACKUP", * clusterResourceRestoreScope: { * selectedGroupKinds: [ * { * resourceGroup: "apiextension.k8s.io", * resourceKind: "CustomResourceDefinition", * }, * { * resourceGroup: "storage.k8s.io", * resourceKind: "StorageClass", * }, * ], * }, * clusterResourceConflictPolicy: "USE_EXISTING_VERSION", * }, * }); * ``` * ### Gkebackup Restoreplan Protected Application * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.container.Cluster("primary", { * name: "rollback-app-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: "rollback-app", * cluster: primary.id, * location: "us-central1", * backupConfig: { * includeVolumeData: true, * includeSecrets: true, * allNamespaces: true, * }, * }); * const rollbackApp = new gcp.gkebackup.RestorePlan("rollback_app", { * name: "rollback-app-rp", * location: "us-central1", * backupPlan: basic.id, * cluster: primary.id, * restoreConfig: { * selectedApplications: { * namespacedNames: [{ * name: "my-app", * namespace: "my-ns", * }], * }, * namespacedResourceRestoreMode: "DELETE_AND_RESTORE", * volumeDataRestorePolicy: "REUSE_VOLUME_HANDLE_FROM_BACKUP", * clusterResourceRestoreScope: { * noGroupKinds: true, * }, * }, * }); * ``` * ### Gkebackup Restoreplan All Cluster Resources * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.container.Cluster("primary", { * name: "all-groupkinds-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: "all-groupkinds", * cluster: primary.id, * location: "us-central1", * backupConfig: { * includeVolumeData: true, * includeSecrets: true, * allNamespaces: true, * }, * }); * const allClusterResources = new gcp.gkebackup.RestorePlan("all_cluster_resources", { * name: "all-groupkinds-rp", * location: "us-central1", * backupPlan: basic.id, * cluster: primary.id, * restoreConfig: { * noNamespaces: true, * namespacedResourceRestoreMode: "FAIL_ON_CONFLICT", * clusterResourceRestoreScope: { * allGroupKinds: true, * }, * clusterResourceConflictPolicy: "USE_EXISTING_VERSION", * }, * }); * ``` * ### Gkebackup Restoreplan Rename Namespace * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.container.Cluster("primary", { * name: "rename-ns-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: "rename-ns", * cluster: primary.id, * location: "us-central1", * backupConfig: { * includeVolumeData: true, * includeSecrets: true, * allNamespaces: true, * }, * }); * const renameNs = new gcp.gkebackup.RestorePlan("rename_ns", { * name: "rename-ns-rp", * location: "us-central1", * backupPlan: basic.id, * cluster: primary.id, * restoreConfig: { * selectedNamespaces: { * namespaces: ["ns1"], * }, * namespacedResourceRestoreMode: "FAIL_ON_CONFLICT", * volumeDataRestorePolicy: "REUSE_VOLUME_HANDLE_FROM_BACKUP", * clusterResourceRestoreScope: { * noGroupKinds: true, * }, * transformationRules: [ * { * description: "rename namespace from ns1 to ns2", * resourceFilter: { * groupKinds: [{ * resourceKind: "Namespace", * }], * jsonPath: ".metadata[?(@.name == 'ns1')]", * }, * fieldActions: [{ * op: "REPLACE", * path: "/metadata/name", * value: "ns2", * }], * }, * { * description: "move all resources from ns1 to ns2", * resourceFilter: { * namespaces: ["ns1"], * }, * fieldActions: [{ * op: "REPLACE", * path: "/metadata/namespace", * value: "ns2", * }], * }, * ], * }, * }); * ``` * ### Gkebackup Restoreplan Second Transformation * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.container.Cluster("primary", { * name: "transform-rule-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: "transform-rule", * cluster: primary.id, * location: "us-central1", * backupConfig: { * includeVolumeData: true, * includeSecrets: true, * allNamespaces: true, * }, * }); * const transformRule = new gcp.gkebackup.RestorePlan("transform_rule", { * name: "transform-rule-rp", * description: "copy nginx env variables", * labels: { * app: "nginx", * }, * location: "us-central1", * backupPlan: basic.id, * cluster: primary.id, * restoreConfig: { * excludedNamespaces: { * namespaces: ["my-ns"], * }, * namespacedResourceRestoreMode: "DELETE_AND_RESTORE", * volumeDataRestorePolicy: "RESTORE_VOLUME_DATA_FROM_BACKUP", * clusterResourceRestoreScope: { * excludedGroupKinds: [{ * resourceGroup: "apiextension.k8s.io", * resourceKind: "CustomResourceDefinition", * }], * }, * clusterResourceConflictPolicy: "USE_EXISTING_VERSION", * transformationRules: [{ * description: "Copy environment variables from the nginx container to the install init container.", * resourceFilter: { * groupKinds: [{ * resourceKind: "Pod", * resourceGroup: "", * }], * jsonPath: ".metadata[?(@.name == 'nginx')]", * }, * fieldActions: [{ * op: "COPY", * path: "/spec/initContainers/0/env", * fromPath: "/spec/containers/0/env", * }], * }], * }, * }); * ``` * ### Gkebackup Restoreplan Gitops Mode * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.container.Cluster("primary", { * name: "gitops-mode-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: "gitops-mode", * cluster: primary.id, * location: "us-central1", * backupConfig: { * includeVolumeData: true, * includeSecrets: true, * allNamespaces: true, * }, * }); * const gitopsMode = new gcp.gkebackup.RestorePlan("gitops_mode", { * name: "gitops-mode", * location: "us-central1", * backupPlan: basic.id, * cluster: primary.id, * restoreConfig: { * allNamespaces: true, * namespacedResourceRestoreMode: "MERGE_SKIP_ON_CONFLICT", * volumeDataRestorePolicy: "RESTORE_VOLUME_DATA_FROM_BACKUP", * clusterResourceRestoreScope: { * allGroupKinds: true, * }, * clusterResourceConflictPolicy: "USE_EXISTING_VERSION", * }, * }); * ``` * ### Gkebackup Restoreplan Restore Order * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.container.Cluster("primary", { * name: "restore-order-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: "restore-order", * cluster: primary.id, * location: "us-central1", * backupConfig: { * includeVolumeData: true, * includeSecrets: true, * allNamespaces: true, * }, * }); * const restoreOrder = new gcp.gkebackup.RestorePlan("restore_order", { * name: "restore-order", * location: "us-central1", * backupPlan: basic.id, * cluster: primary.id, * restoreConfig: { * allNamespaces: true, * namespacedResourceRestoreMode: "FAIL_ON_CONFLICT", * volumeDataRestorePolicy: "RESTORE_VOLUME_DATA_FROM_BACKUP", * clusterResourceRestoreScope: { * allGroupKinds: true, * }, * clusterResourceConflictPolicy: "USE_EXISTING_VERSION", * restoreOrder: { * groupKindDependencies: [ * { * satisfying: { * resourceGroup: "stable.example.com", * resourceKind: "kindA", * }, * requiring: { * resourceGroup: "stable.example.com", * resourceKind: "kindB", * }, * }, * { * satisfying: { * resourceGroup: "stable.example.com", * resourceKind: "kindB", * }, * requiring: { * resourceGroup: "stable.example.com", * resourceKind: "kindC", * }, * }, * ], * }, * }, * }); * ``` * ### Gkebackup Restoreplan Volume Res * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const primary = new gcp.container.Cluster("primary", { * name: "volume-res-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: "volume-res", * cluster: primary.id, * location: "us-central1", * backupConfig: { * includeVolumeData: true, * includeSecrets: true, * allNamespaces: true, * }, * }); * const volumeRes = new gcp.gkebackup.RestorePlan("volume_res", { * name: "volume-res", * location: "us-central1", * backupPlan: basic.id, * cluster: primary.id, * restoreConfig: { * allNamespaces: true, * namespacedResourceRestoreMode: "FAIL_ON_CONFLICT", * volumeDataRestorePolicy: "NO_VOLUME_DATA_RESTORATION", * clusterResourceRestoreScope: { * allGroupKinds: true, * }, * clusterResourceConflictPolicy: "USE_EXISTING_VERSION", * volumeDataRestorePolicyBindings: [{ * policy: "RESTORE_VOLUME_DATA_FROM_BACKUP", * volumeType: "GCE_PERSISTENT_DISK", * }], * }, * }); * ``` * * ## Import * * RestorePlan can be imported using any of these accepted formats: * * * `projects/{{project}}/locations/{{location}}/restorePlans/{{name}}` * * * `{{project}}/{{location}}/{{name}}` * * * `{{location}}/{{name}}` * * When using the `pulumi import` command, RestorePlan can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:gkebackup/restorePlan:RestorePlan default projects/{{project}}/locations/{{location}}/restorePlans/{{name}} * ``` * * ```sh * $ pulumi import gcp:gkebackup/restorePlan:RestorePlan default {{project}}/{{location}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:gkebackup/restorePlan:RestorePlan default {{location}}/{{name}} * ``` */ export declare class RestorePlan extends pulumi.CustomResource { /** * Get an existing RestorePlan 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: string, id: pulumi.Input, state?: RestorePlanState, opts?: pulumi.CustomResourceOptions): RestorePlan; /** * Returns true if the given object is an instance of RestorePlan. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is RestorePlan; /** * A reference to the BackupPlan from which Backups may be used * as the source for Restores created via this RestorePlan. */ readonly backupPlan: pulumi.Output; /** * The source cluster from which Restores will be created via this RestorePlan. */ readonly cluster: pulumi.Output; /** * User specified descriptive string for this RestorePlan. */ readonly description: pulumi.Output; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ readonly effectiveLabels: pulumi.Output<{ [key: string]: string; }>; /** * Description: A set of custom labels supplied by the user. * A list of key->value pairs. * Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ readonly labels: pulumi.Output<{ [key: string]: string; } | undefined>; /** * The region of the Restore Plan. */ readonly location: pulumi.Output; /** * The full name of the BackupPlan Resource. */ readonly name: pulumi.Output; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ readonly project: pulumi.Output; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ readonly pulumiLabels: pulumi.Output<{ [key: string]: string; }>; /** * Defines the configuration of Restores created via this RestorePlan. * Structure is documented below. */ readonly restoreConfig: pulumi.Output; /** * The State of the RestorePlan. */ readonly state: pulumi.Output; /** * Detailed description of why RestorePlan is in its current state. */ readonly stateReason: pulumi.Output; /** * Server generated, unique identifier of UUID format. */ readonly uid: pulumi.Output; /** * Create a RestorePlan resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: RestorePlanArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering RestorePlan resources. */ export interface RestorePlanState { /** * A reference to the BackupPlan from which Backups may be used * as the source for Restores created via this RestorePlan. */ backupPlan?: pulumi.Input; /** * The source cluster from which Restores will be created via this RestorePlan. */ cluster?: pulumi.Input; /** * User specified descriptive string for this RestorePlan. */ description?: pulumi.Input; /** * All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services. */ effectiveLabels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Description: A set of custom labels supplied by the user. * A list of key->value pairs. * Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * The region of the Restore Plan. */ location?: pulumi.Input; /** * The full name of the BackupPlan Resource. */ name?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ pulumiLabels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * Defines the configuration of Restores created via this RestorePlan. * Structure is documented below. */ restoreConfig?: pulumi.Input; /** * The State of the RestorePlan. */ state?: pulumi.Input; /** * Detailed description of why RestorePlan is in its current state. */ stateReason?: pulumi.Input; /** * Server generated, unique identifier of UUID format. */ uid?: pulumi.Input; } /** * The set of arguments for constructing a RestorePlan resource. */ export interface RestorePlanArgs { /** * A reference to the BackupPlan from which Backups may be used * as the source for Restores created via this RestorePlan. */ backupPlan: pulumi.Input; /** * The source cluster from which Restores will be created via this RestorePlan. */ cluster: pulumi.Input; /** * User specified descriptive string for this RestorePlan. */ description?: pulumi.Input; /** * Description: A set of custom labels supplied by the user. * A list of key->value pairs. * Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }. * * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration. * Please refer to the field `effectiveLabels` for all of the labels present on the resource. */ labels?: pulumi.Input<{ [key: string]: pulumi.Input; }>; /** * The region of the Restore Plan. */ location: pulumi.Input; /** * The full name of the BackupPlan Resource. */ name?: pulumi.Input; /** * The ID of the project in which the resource belongs. * If it is not provided, the provider project is used. */ project?: pulumi.Input; /** * Defines the configuration of Restores created via this RestorePlan. * Structure is documented below. */ restoreConfig: pulumi.Input; }