com.pulumi.gcp.gkebackup.kotlin.RestorePlanIamBinding.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.gkebackup.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.gkebackup.kotlin.outputs.RestorePlanIamBindingCondition
import com.pulumi.gcp.gkebackup.kotlin.outputs.RestorePlanIamBindingCondition.Companion.toKotlin
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
/**
* Builder for [RestorePlanIamBinding].
*/
@PulumiTagMarker
public class RestorePlanIamBindingResourceBuilder internal constructor() {
public var name: String? = null
public var args: RestorePlanIamBindingArgs = RestorePlanIamBindingArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend RestorePlanIamBindingArgsBuilder.() -> Unit) {
val builder = RestorePlanIamBindingArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): RestorePlanIamBinding {
val builtJavaResource = com.pulumi.gcp.gkebackup.RestorePlanIamBinding(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return RestorePlanIamBinding(builtJavaResource)
}
}
/**
* 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: "",
* 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",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* primary = gcp.container.Cluster("primary",
* name="restore-all-ns-cluster",
* location="us-central1",
* initial_node_count=1,
* workload_identity_config=gcp.container.ClusterWorkloadIdentityConfigArgs(
* workload_pool="my-project-name.svc.id.goog",
* ),
* addons_config=gcp.container.ClusterAddonsConfigArgs(
* gke_backup_agent_config=gcp.container.ClusterAddonsConfigGkeBackupAgentConfigArgs(
* enabled=True,
* ),
* ),
* deletion_protection="",
* network="default",
* subnetwork="default")
* basic = gcp.gkebackup.BackupPlan("basic",
* name="restore-all-ns",
* cluster=primary.id,
* location="us-central1",
* backup_config=gcp.gkebackup.BackupPlanBackupConfigArgs(
* include_volume_data=True,
* include_secrets=True,
* all_namespaces=True,
* ))
* all_ns = gcp.gkebackup.RestorePlan("all_ns",
* name="restore-all-ns",
* location="us-central1",
* backup_plan=basic.id,
* cluster=primary.id,
* restore_config=gcp.gkebackup.RestorePlanRestoreConfigArgs(
* all_namespaces=True,
* namespaced_resource_restore_mode="FAIL_ON_CONFLICT",
* volume_data_restore_policy="RESTORE_VOLUME_DATA_FROM_BACKUP",
* cluster_resource_restore_scope=gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs(
* all_group_kinds=True,
* ),
* cluster_resource_conflict_policy="USE_EXISTING_VERSION",
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var primary = new Gcp.Container.Cluster("primary", new()
* {
* Name = "restore-all-ns-cluster",
* Location = "us-central1",
* InitialNodeCount = 1,
* WorkloadIdentityConfig = new Gcp.Container.Inputs.ClusterWorkloadIdentityConfigArgs
* {
* WorkloadPool = "my-project-name.svc.id.goog",
* },
* AddonsConfig = new Gcp.Container.Inputs.ClusterAddonsConfigArgs
* {
* GkeBackupAgentConfig = new Gcp.Container.Inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs
* {
* Enabled = true,
* },
* },
* DeletionProtection = "",
* Network = "default",
* Subnetwork = "default",
* });
* var basic = new Gcp.GkeBackup.BackupPlan("basic", new()
* {
* Name = "restore-all-ns",
* Cluster = primary.Id,
* Location = "us-central1",
* BackupConfig = new Gcp.GkeBackup.Inputs.BackupPlanBackupConfigArgs
* {
* IncludeVolumeData = true,
* IncludeSecrets = true,
* AllNamespaces = true,
* },
* });
* var allNs = new Gcp.GkeBackup.RestorePlan("all_ns", new()
* {
* Name = "restore-all-ns",
* Location = "us-central1",
* BackupPlan = basic.Id,
* Cluster = primary.Id,
* RestoreConfig = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigArgs
* {
* AllNamespaces = true,
* NamespacedResourceRestoreMode = "FAIL_ON_CONFLICT",
* VolumeDataRestorePolicy = "RESTORE_VOLUME_DATA_FROM_BACKUP",
* ClusterResourceRestoreScope = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs
* {
* AllGroupKinds = true,
* },
* ClusterResourceConflictPolicy = "USE_EXISTING_VERSION",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkebackup"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
* Name: pulumi.String("restore-all-ns-cluster"),
* Location: pulumi.String("us-central1"),
* InitialNodeCount: pulumi.Int(1),
* WorkloadIdentityConfig: &container.ClusterWorkloadIdentityConfigArgs{
* WorkloadPool: pulumi.String("my-project-name.svc.id.goog"),
* },
* AddonsConfig: &container.ClusterAddonsConfigArgs{
* GkeBackupAgentConfig: &container.ClusterAddonsConfigGkeBackupAgentConfigArgs{
* Enabled: pulumi.Bool(true),
* },
* },
* DeletionProtection: pulumi.Bool(""),
* Network: pulumi.String("default"),
* Subnetwork: pulumi.String("default"),
* })
* if err != nil {
* return err
* }
* basic, err := gkebackup.NewBackupPlan(ctx, "basic", &gkebackup.BackupPlanArgs{
* Name: pulumi.String("restore-all-ns"),
* Cluster: primary.ID(),
* Location: pulumi.String("us-central1"),
* BackupConfig: &gkebackup.BackupPlanBackupConfigArgs{
* IncludeVolumeData: pulumi.Bool(true),
* IncludeSecrets: pulumi.Bool(true),
* AllNamespaces: pulumi.Bool(true),
* },
* })
* if err != nil {
* return err
* }
* _, err = gkebackup.NewRestorePlan(ctx, "all_ns", &gkebackup.RestorePlanArgs{
* Name: pulumi.String("restore-all-ns"),
* Location: pulumi.String("us-central1"),
* BackupPlan: basic.ID(),
* Cluster: primary.ID(),
* RestoreConfig: &gkebackup.RestorePlanRestoreConfigArgs{
* AllNamespaces: pulumi.Bool(true),
* NamespacedResourceRestoreMode: pulumi.String("FAIL_ON_CONFLICT"),
* VolumeDataRestorePolicy: pulumi.String("RESTORE_VOLUME_DATA_FROM_BACKUP"),
* ClusterResourceRestoreScope: &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs{
* AllGroupKinds: pulumi.Bool(true),
* },
* ClusterResourceConflictPolicy: pulumi.String("USE_EXISTING_VERSION"),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.container.Cluster;
* import com.pulumi.gcp.container.ClusterArgs;
* import com.pulumi.gcp.container.inputs.ClusterWorkloadIdentityConfigArgs;
* import com.pulumi.gcp.container.inputs.ClusterAddonsConfigArgs;
* import com.pulumi.gcp.container.inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs;
* import com.pulumi.gcp.gkebackup.BackupPlan;
* import com.pulumi.gcp.gkebackup.BackupPlanArgs;
* import com.pulumi.gcp.gkebackup.inputs.BackupPlanBackupConfigArgs;
* import com.pulumi.gcp.gkebackup.RestorePlan;
* import com.pulumi.gcp.gkebackup.RestorePlanArgs;
* import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigArgs;
* import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var primary = new Cluster("primary", ClusterArgs.builder()
* .name("restore-all-ns-cluster")
* .location("us-central1")
* .initialNodeCount(1)
* .workloadIdentityConfig(ClusterWorkloadIdentityConfigArgs.builder()
* .workloadPool("my-project-name.svc.id.goog")
* .build())
* .addonsConfig(ClusterAddonsConfigArgs.builder()
* .gkeBackupAgentConfig(ClusterAddonsConfigGkeBackupAgentConfigArgs.builder()
* .enabled(true)
* .build())
* .build())
* .deletionProtection("")
* .network("default")
* .subnetwork("default")
* .build());
* var basic = new BackupPlan("basic", BackupPlanArgs.builder()
* .name("restore-all-ns")
* .cluster(primary.id())
* .location("us-central1")
* .backupConfig(BackupPlanBackupConfigArgs.builder()
* .includeVolumeData(true)
* .includeSecrets(true)
* .allNamespaces(true)
* .build())
* .build());
* var allNs = new RestorePlan("allNs", RestorePlanArgs.builder()
* .name("restore-all-ns")
* .location("us-central1")
* .backupPlan(basic.id())
* .cluster(primary.id())
* .restoreConfig(RestorePlanRestoreConfigArgs.builder()
* .allNamespaces(true)
* .namespacedResourceRestoreMode("FAIL_ON_CONFLICT")
* .volumeDataRestorePolicy("RESTORE_VOLUME_DATA_FROM_BACKUP")
* .clusterResourceRestoreScope(RestorePlanRestoreConfigClusterResourceRestoreScopeArgs.builder()
* .allGroupKinds(true)
* .build())
* .clusterResourceConflictPolicy("USE_EXISTING_VERSION")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* primary:
* type: gcp:container:Cluster
* properties:
* name: restore-all-ns-cluster
* location: us-central1
* initialNodeCount: 1
* workloadIdentityConfig:
* workloadPool: my-project-name.svc.id.goog
* addonsConfig:
* gkeBackupAgentConfig:
* enabled: true
* deletionProtection:
* network: default
* subnetwork: default
* basic:
* type: gcp:gkebackup:BackupPlan
* properties:
* name: restore-all-ns
* cluster: ${primary.id}
* location: us-central1
* backupConfig:
* includeVolumeData: true
* includeSecrets: true
* allNamespaces: true
* allNs:
* type: gcp:gkebackup:RestorePlan
* name: all_ns
* properties:
* 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: "",
* 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",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* primary = gcp.container.Cluster("primary",
* name="rollback-ns-cluster",
* location="us-central1",
* initial_node_count=1,
* workload_identity_config=gcp.container.ClusterWorkloadIdentityConfigArgs(
* workload_pool="my-project-name.svc.id.goog",
* ),
* addons_config=gcp.container.ClusterAddonsConfigArgs(
* gke_backup_agent_config=gcp.container.ClusterAddonsConfigGkeBackupAgentConfigArgs(
* enabled=True,
* ),
* ),
* deletion_protection="",
* network="default",
* subnetwork="default")
* basic = gcp.gkebackup.BackupPlan("basic",
* name="rollback-ns",
* cluster=primary.id,
* location="us-central1",
* backup_config=gcp.gkebackup.BackupPlanBackupConfigArgs(
* include_volume_data=True,
* include_secrets=True,
* all_namespaces=True,
* ))
* rollback_ns = gcp.gkebackup.RestorePlan("rollback_ns",
* name="rollback-ns-rp",
* location="us-central1",
* backup_plan=basic.id,
* cluster=primary.id,
* restore_config=gcp.gkebackup.RestorePlanRestoreConfigArgs(
* selected_namespaces=gcp.gkebackup.RestorePlanRestoreConfigSelectedNamespacesArgs(
* namespaces=["my-ns"],
* ),
* namespaced_resource_restore_mode="DELETE_AND_RESTORE",
* volume_data_restore_policy="RESTORE_VOLUME_DATA_FROM_BACKUP",
* cluster_resource_restore_scope=gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs(
* selected_group_kinds=[
* gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArgs(
* resource_group="apiextension.k8s.io",
* resource_kind="CustomResourceDefinition",
* ),
* gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArgs(
* resource_group="storage.k8s.io",
* resource_kind="StorageClass",
* ),
* ],
* ),
* cluster_resource_conflict_policy="USE_EXISTING_VERSION",
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var primary = new Gcp.Container.Cluster("primary", new()
* {
* Name = "rollback-ns-cluster",
* Location = "us-central1",
* InitialNodeCount = 1,
* WorkloadIdentityConfig = new Gcp.Container.Inputs.ClusterWorkloadIdentityConfigArgs
* {
* WorkloadPool = "my-project-name.svc.id.goog",
* },
* AddonsConfig = new Gcp.Container.Inputs.ClusterAddonsConfigArgs
* {
* GkeBackupAgentConfig = new Gcp.Container.Inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs
* {
* Enabled = true,
* },
* },
* DeletionProtection = "",
* Network = "default",
* Subnetwork = "default",
* });
* var basic = new Gcp.GkeBackup.BackupPlan("basic", new()
* {
* Name = "rollback-ns",
* Cluster = primary.Id,
* Location = "us-central1",
* BackupConfig = new Gcp.GkeBackup.Inputs.BackupPlanBackupConfigArgs
* {
* IncludeVolumeData = true,
* IncludeSecrets = true,
* AllNamespaces = true,
* },
* });
* var rollbackNs = new Gcp.GkeBackup.RestorePlan("rollback_ns", new()
* {
* Name = "rollback-ns-rp",
* Location = "us-central1",
* BackupPlan = basic.Id,
* Cluster = primary.Id,
* RestoreConfig = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigArgs
* {
* SelectedNamespaces = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigSelectedNamespacesArgs
* {
* Namespaces = new[]
* {
* "my-ns",
* },
* },
* NamespacedResourceRestoreMode = "DELETE_AND_RESTORE",
* VolumeDataRestorePolicy = "RESTORE_VOLUME_DATA_FROM_BACKUP",
* ClusterResourceRestoreScope = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs
* {
* SelectedGroupKinds = new[]
* {
* new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArgs
* {
* ResourceGroup = "apiextension.k8s.io",
* ResourceKind = "CustomResourceDefinition",
* },
* new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArgs
* {
* ResourceGroup = "storage.k8s.io",
* ResourceKind = "StorageClass",
* },
* },
* },
* ClusterResourceConflictPolicy = "USE_EXISTING_VERSION",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkebackup"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
* Name: pulumi.String("rollback-ns-cluster"),
* Location: pulumi.String("us-central1"),
* InitialNodeCount: pulumi.Int(1),
* WorkloadIdentityConfig: &container.ClusterWorkloadIdentityConfigArgs{
* WorkloadPool: pulumi.String("my-project-name.svc.id.goog"),
* },
* AddonsConfig: &container.ClusterAddonsConfigArgs{
* GkeBackupAgentConfig: &container.ClusterAddonsConfigGkeBackupAgentConfigArgs{
* Enabled: pulumi.Bool(true),
* },
* },
* DeletionProtection: pulumi.Bool(""),
* Network: pulumi.String("default"),
* Subnetwork: pulumi.String("default"),
* })
* if err != nil {
* return err
* }
* basic, err := gkebackup.NewBackupPlan(ctx, "basic", &gkebackup.BackupPlanArgs{
* Name: pulumi.String("rollback-ns"),
* Cluster: primary.ID(),
* Location: pulumi.String("us-central1"),
* BackupConfig: &gkebackup.BackupPlanBackupConfigArgs{
* IncludeVolumeData: pulumi.Bool(true),
* IncludeSecrets: pulumi.Bool(true),
* AllNamespaces: pulumi.Bool(true),
* },
* })
* if err != nil {
* return err
* }
* _, err = gkebackup.NewRestorePlan(ctx, "rollback_ns", &gkebackup.RestorePlanArgs{
* Name: pulumi.String("rollback-ns-rp"),
* Location: pulumi.String("us-central1"),
* BackupPlan: basic.ID(),
* Cluster: primary.ID(),
* RestoreConfig: &gkebackup.RestorePlanRestoreConfigArgs{
* SelectedNamespaces: &gkebackup.RestorePlanRestoreConfigSelectedNamespacesArgs{
* Namespaces: pulumi.StringArray{
* pulumi.String("my-ns"),
* },
* },
* NamespacedResourceRestoreMode: pulumi.String("DELETE_AND_RESTORE"),
* VolumeDataRestorePolicy: pulumi.String("RESTORE_VOLUME_DATA_FROM_BACKUP"),
* ClusterResourceRestoreScope: &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs{
* SelectedGroupKinds: gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArray{
* &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArgs{
* ResourceGroup: pulumi.String("apiextension.k8s.io"),
* ResourceKind: pulumi.String("CustomResourceDefinition"),
* },
* &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArgs{
* ResourceGroup: pulumi.String("storage.k8s.io"),
* ResourceKind: pulumi.String("StorageClass"),
* },
* },
* },
* ClusterResourceConflictPolicy: pulumi.String("USE_EXISTING_VERSION"),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.container.Cluster;
* import com.pulumi.gcp.container.ClusterArgs;
* import com.pulumi.gcp.container.inputs.ClusterWorkloadIdentityConfigArgs;
* import com.pulumi.gcp.container.inputs.ClusterAddonsConfigArgs;
* import com.pulumi.gcp.container.inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs;
* import com.pulumi.gcp.gkebackup.BackupPlan;
* import com.pulumi.gcp.gkebackup.BackupPlanArgs;
* import com.pulumi.gcp.gkebackup.inputs.BackupPlanBackupConfigArgs;
* import com.pulumi.gcp.gkebackup.RestorePlan;
* import com.pulumi.gcp.gkebackup.RestorePlanArgs;
* import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigArgs;
* import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigSelectedNamespacesArgs;
* import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var primary = new Cluster("primary", ClusterArgs.builder()
* .name("rollback-ns-cluster")
* .location("us-central1")
* .initialNodeCount(1)
* .workloadIdentityConfig(ClusterWorkloadIdentityConfigArgs.builder()
* .workloadPool("my-project-name.svc.id.goog")
* .build())
* .addonsConfig(ClusterAddonsConfigArgs.builder()
* .gkeBackupAgentConfig(ClusterAddonsConfigGkeBackupAgentConfigArgs.builder()
* .enabled(true)
* .build())
* .build())
* .deletionProtection("")
* .network("default")
* .subnetwork("default")
* .build());
* var basic = new BackupPlan("basic", BackupPlanArgs.builder()
* .name("rollback-ns")
* .cluster(primary.id())
* .location("us-central1")
* .backupConfig(BackupPlanBackupConfigArgs.builder()
* .includeVolumeData(true)
* .includeSecrets(true)
* .allNamespaces(true)
* .build())
* .build());
* var rollbackNs = new RestorePlan("rollbackNs", RestorePlanArgs.builder()
* .name("rollback-ns-rp")
* .location("us-central1")
* .backupPlan(basic.id())
* .cluster(primary.id())
* .restoreConfig(RestorePlanRestoreConfigArgs.builder()
* .selectedNamespaces(RestorePlanRestoreConfigSelectedNamespacesArgs.builder()
* .namespaces("my-ns")
* .build())
* .namespacedResourceRestoreMode("DELETE_AND_RESTORE")
* .volumeDataRestorePolicy("RESTORE_VOLUME_DATA_FROM_BACKUP")
* .clusterResourceRestoreScope(RestorePlanRestoreConfigClusterResourceRestoreScopeArgs.builder()
* .selectedGroupKinds(
* RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArgs.builder()
* .resourceGroup("apiextension.k8s.io")
* .resourceKind("CustomResourceDefinition")
* .build(),
* RestorePlanRestoreConfigClusterResourceRestoreScopeSelectedGroupKindArgs.builder()
* .resourceGroup("storage.k8s.io")
* .resourceKind("StorageClass")
* .build())
* .build())
* .clusterResourceConflictPolicy("USE_EXISTING_VERSION")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* primary:
* type: gcp:container:Cluster
* properties:
* name: rollback-ns-cluster
* location: us-central1
* initialNodeCount: 1
* workloadIdentityConfig:
* workloadPool: my-project-name.svc.id.goog
* addonsConfig:
* gkeBackupAgentConfig:
* enabled: true
* deletionProtection:
* network: default
* subnetwork: default
* basic:
* type: gcp:gkebackup:BackupPlan
* properties:
* name: rollback-ns
* cluster: ${primary.id}
* location: us-central1
* backupConfig:
* includeVolumeData: true
* includeSecrets: true
* allNamespaces: true
* rollbackNs:
* type: gcp:gkebackup:RestorePlan
* name: rollback_ns
* properties:
* 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: "",
* 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,
* },
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* primary = gcp.container.Cluster("primary",
* name="rollback-app-cluster",
* location="us-central1",
* initial_node_count=1,
* workload_identity_config=gcp.container.ClusterWorkloadIdentityConfigArgs(
* workload_pool="my-project-name.svc.id.goog",
* ),
* addons_config=gcp.container.ClusterAddonsConfigArgs(
* gke_backup_agent_config=gcp.container.ClusterAddonsConfigGkeBackupAgentConfigArgs(
* enabled=True,
* ),
* ),
* deletion_protection="",
* network="default",
* subnetwork="default")
* basic = gcp.gkebackup.BackupPlan("basic",
* name="rollback-app",
* cluster=primary.id,
* location="us-central1",
* backup_config=gcp.gkebackup.BackupPlanBackupConfigArgs(
* include_volume_data=True,
* include_secrets=True,
* all_namespaces=True,
* ))
* rollback_app = gcp.gkebackup.RestorePlan("rollback_app",
* name="rollback-app-rp",
* location="us-central1",
* backup_plan=basic.id,
* cluster=primary.id,
* restore_config=gcp.gkebackup.RestorePlanRestoreConfigArgs(
* selected_applications=gcp.gkebackup.RestorePlanRestoreConfigSelectedApplicationsArgs(
* namespaced_names=[gcp.gkebackup.RestorePlanRestoreConfigSelectedApplicationsNamespacedNameArgs(
* name="my-app",
* namespace="my-ns",
* )],
* ),
* namespaced_resource_restore_mode="DELETE_AND_RESTORE",
* volume_data_restore_policy="REUSE_VOLUME_HANDLE_FROM_BACKUP",
* cluster_resource_restore_scope=gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs(
* no_group_kinds=True,
* ),
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var primary = new Gcp.Container.Cluster("primary", new()
* {
* Name = "rollback-app-cluster",
* Location = "us-central1",
* InitialNodeCount = 1,
* WorkloadIdentityConfig = new Gcp.Container.Inputs.ClusterWorkloadIdentityConfigArgs
* {
* WorkloadPool = "my-project-name.svc.id.goog",
* },
* AddonsConfig = new Gcp.Container.Inputs.ClusterAddonsConfigArgs
* {
* GkeBackupAgentConfig = new Gcp.Container.Inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs
* {
* Enabled = true,
* },
* },
* DeletionProtection = "",
* Network = "default",
* Subnetwork = "default",
* });
* var basic = new Gcp.GkeBackup.BackupPlan("basic", new()
* {
* Name = "rollback-app",
* Cluster = primary.Id,
* Location = "us-central1",
* BackupConfig = new Gcp.GkeBackup.Inputs.BackupPlanBackupConfigArgs
* {
* IncludeVolumeData = true,
* IncludeSecrets = true,
* AllNamespaces = true,
* },
* });
* var rollbackApp = new Gcp.GkeBackup.RestorePlan("rollback_app", new()
* {
* Name = "rollback-app-rp",
* Location = "us-central1",
* BackupPlan = basic.Id,
* Cluster = primary.Id,
* RestoreConfig = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigArgs
* {
* SelectedApplications = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigSelectedApplicationsArgs
* {
* NamespacedNames = new[]
* {
* new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigSelectedApplicationsNamespacedNameArgs
* {
* Name = "my-app",
* Namespace = "my-ns",
* },
* },
* },
* NamespacedResourceRestoreMode = "DELETE_AND_RESTORE",
* VolumeDataRestorePolicy = "REUSE_VOLUME_HANDLE_FROM_BACKUP",
* ClusterResourceRestoreScope = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs
* {
* NoGroupKinds = true,
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkebackup"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
* Name: pulumi.String("rollback-app-cluster"),
* Location: pulumi.String("us-central1"),
* InitialNodeCount: pulumi.Int(1),
* WorkloadIdentityConfig: &container.ClusterWorkloadIdentityConfigArgs{
* WorkloadPool: pulumi.String("my-project-name.svc.id.goog"),
* },
* AddonsConfig: &container.ClusterAddonsConfigArgs{
* GkeBackupAgentConfig: &container.ClusterAddonsConfigGkeBackupAgentConfigArgs{
* Enabled: pulumi.Bool(true),
* },
* },
* DeletionProtection: pulumi.Bool(""),
* Network: pulumi.String("default"),
* Subnetwork: pulumi.String("default"),
* })
* if err != nil {
* return err
* }
* basic, err := gkebackup.NewBackupPlan(ctx, "basic", &gkebackup.BackupPlanArgs{
* Name: pulumi.String("rollback-app"),
* Cluster: primary.ID(),
* Location: pulumi.String("us-central1"),
* BackupConfig: &gkebackup.BackupPlanBackupConfigArgs{
* IncludeVolumeData: pulumi.Bool(true),
* IncludeSecrets: pulumi.Bool(true),
* AllNamespaces: pulumi.Bool(true),
* },
* })
* if err != nil {
* return err
* }
* _, err = gkebackup.NewRestorePlan(ctx, "rollback_app", &gkebackup.RestorePlanArgs{
* Name: pulumi.String("rollback-app-rp"),
* Location: pulumi.String("us-central1"),
* BackupPlan: basic.ID(),
* Cluster: primary.ID(),
* RestoreConfig: &gkebackup.RestorePlanRestoreConfigArgs{
* SelectedApplications: &gkebackup.RestorePlanRestoreConfigSelectedApplicationsArgs{
* NamespacedNames: gkebackup.RestorePlanRestoreConfigSelectedApplicationsNamespacedNameArray{
* &gkebackup.RestorePlanRestoreConfigSelectedApplicationsNamespacedNameArgs{
* Name: pulumi.String("my-app"),
* Namespace: pulumi.String("my-ns"),
* },
* },
* },
* NamespacedResourceRestoreMode: pulumi.String("DELETE_AND_RESTORE"),
* VolumeDataRestorePolicy: pulumi.String("REUSE_VOLUME_HANDLE_FROM_BACKUP"),
* ClusterResourceRestoreScope: &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs{
* NoGroupKinds: pulumi.Bool(true),
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.container.Cluster;
* import com.pulumi.gcp.container.ClusterArgs;
* import com.pulumi.gcp.container.inputs.ClusterWorkloadIdentityConfigArgs;
* import com.pulumi.gcp.container.inputs.ClusterAddonsConfigArgs;
* import com.pulumi.gcp.container.inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs;
* import com.pulumi.gcp.gkebackup.BackupPlan;
* import com.pulumi.gcp.gkebackup.BackupPlanArgs;
* import com.pulumi.gcp.gkebackup.inputs.BackupPlanBackupConfigArgs;
* import com.pulumi.gcp.gkebackup.RestorePlan;
* import com.pulumi.gcp.gkebackup.RestorePlanArgs;
* import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigArgs;
* import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigSelectedApplicationsArgs;
* import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var primary = new Cluster("primary", ClusterArgs.builder()
* .name("rollback-app-cluster")
* .location("us-central1")
* .initialNodeCount(1)
* .workloadIdentityConfig(ClusterWorkloadIdentityConfigArgs.builder()
* .workloadPool("my-project-name.svc.id.goog")
* .build())
* .addonsConfig(ClusterAddonsConfigArgs.builder()
* .gkeBackupAgentConfig(ClusterAddonsConfigGkeBackupAgentConfigArgs.builder()
* .enabled(true)
* .build())
* .build())
* .deletionProtection("")
* .network("default")
* .subnetwork("default")
* .build());
* var basic = new BackupPlan("basic", BackupPlanArgs.builder()
* .name("rollback-app")
* .cluster(primary.id())
* .location("us-central1")
* .backupConfig(BackupPlanBackupConfigArgs.builder()
* .includeVolumeData(true)
* .includeSecrets(true)
* .allNamespaces(true)
* .build())
* .build());
* var rollbackApp = new RestorePlan("rollbackApp", RestorePlanArgs.builder()
* .name("rollback-app-rp")
* .location("us-central1")
* .backupPlan(basic.id())
* .cluster(primary.id())
* .restoreConfig(RestorePlanRestoreConfigArgs.builder()
* .selectedApplications(RestorePlanRestoreConfigSelectedApplicationsArgs.builder()
* .namespacedNames(RestorePlanRestoreConfigSelectedApplicationsNamespacedNameArgs.builder()
* .name("my-app")
* .namespace("my-ns")
* .build())
* .build())
* .namespacedResourceRestoreMode("DELETE_AND_RESTORE")
* .volumeDataRestorePolicy("REUSE_VOLUME_HANDLE_FROM_BACKUP")
* .clusterResourceRestoreScope(RestorePlanRestoreConfigClusterResourceRestoreScopeArgs.builder()
* .noGroupKinds(true)
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* primary:
* type: gcp:container:Cluster
* properties:
* name: rollback-app-cluster
* location: us-central1
* initialNodeCount: 1
* workloadIdentityConfig:
* workloadPool: my-project-name.svc.id.goog
* addonsConfig:
* gkeBackupAgentConfig:
* enabled: true
* deletionProtection:
* network: default
* subnetwork: default
* basic:
* type: gcp:gkebackup:BackupPlan
* properties:
* name: rollback-app
* cluster: ${primary.id}
* location: us-central1
* backupConfig:
* includeVolumeData: true
* includeSecrets: true
* allNamespaces: true
* rollbackApp:
* type: gcp:gkebackup:RestorePlan
* name: rollback_app
* properties:
* 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: "",
* 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",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* primary = gcp.container.Cluster("primary",
* name="all-groupkinds-cluster",
* location="us-central1",
* initial_node_count=1,
* workload_identity_config=gcp.container.ClusterWorkloadIdentityConfigArgs(
* workload_pool="my-project-name.svc.id.goog",
* ),
* addons_config=gcp.container.ClusterAddonsConfigArgs(
* gke_backup_agent_config=gcp.container.ClusterAddonsConfigGkeBackupAgentConfigArgs(
* enabled=True,
* ),
* ),
* deletion_protection="",
* network="default",
* subnetwork="default")
* basic = gcp.gkebackup.BackupPlan("basic",
* name="all-groupkinds",
* cluster=primary.id,
* location="us-central1",
* backup_config=gcp.gkebackup.BackupPlanBackupConfigArgs(
* include_volume_data=True,
* include_secrets=True,
* all_namespaces=True,
* ))
* all_cluster_resources = gcp.gkebackup.RestorePlan("all_cluster_resources",
* name="all-groupkinds-rp",
* location="us-central1",
* backup_plan=basic.id,
* cluster=primary.id,
* restore_config=gcp.gkebackup.RestorePlanRestoreConfigArgs(
* no_namespaces=True,
* namespaced_resource_restore_mode="FAIL_ON_CONFLICT",
* cluster_resource_restore_scope=gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs(
* all_group_kinds=True,
* ),
* cluster_resource_conflict_policy="USE_EXISTING_VERSION",
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var primary = new Gcp.Container.Cluster("primary", new()
* {
* Name = "all-groupkinds-cluster",
* Location = "us-central1",
* InitialNodeCount = 1,
* WorkloadIdentityConfig = new Gcp.Container.Inputs.ClusterWorkloadIdentityConfigArgs
* {
* WorkloadPool = "my-project-name.svc.id.goog",
* },
* AddonsConfig = new Gcp.Container.Inputs.ClusterAddonsConfigArgs
* {
* GkeBackupAgentConfig = new Gcp.Container.Inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs
* {
* Enabled = true,
* },
* },
* DeletionProtection = "",
* Network = "default",
* Subnetwork = "default",
* });
* var basic = new Gcp.GkeBackup.BackupPlan("basic", new()
* {
* Name = "all-groupkinds",
* Cluster = primary.Id,
* Location = "us-central1",
* BackupConfig = new Gcp.GkeBackup.Inputs.BackupPlanBackupConfigArgs
* {
* IncludeVolumeData = true,
* IncludeSecrets = true,
* AllNamespaces = true,
* },
* });
* var allClusterResources = new Gcp.GkeBackup.RestorePlan("all_cluster_resources", new()
* {
* Name = "all-groupkinds-rp",
* Location = "us-central1",
* BackupPlan = basic.Id,
* Cluster = primary.Id,
* RestoreConfig = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigArgs
* {
* NoNamespaces = true,
* NamespacedResourceRestoreMode = "FAIL_ON_CONFLICT",
* ClusterResourceRestoreScope = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs
* {
* AllGroupKinds = true,
* },
* ClusterResourceConflictPolicy = "USE_EXISTING_VERSION",
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkebackup"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
* Name: pulumi.String("all-groupkinds-cluster"),
* Location: pulumi.String("us-central1"),
* InitialNodeCount: pulumi.Int(1),
* WorkloadIdentityConfig: &container.ClusterWorkloadIdentityConfigArgs{
* WorkloadPool: pulumi.String("my-project-name.svc.id.goog"),
* },
* AddonsConfig: &container.ClusterAddonsConfigArgs{
* GkeBackupAgentConfig: &container.ClusterAddonsConfigGkeBackupAgentConfigArgs{
* Enabled: pulumi.Bool(true),
* },
* },
* DeletionProtection: pulumi.Bool(""),
* Network: pulumi.String("default"),
* Subnetwork: pulumi.String("default"),
* })
* if err != nil {
* return err
* }
* basic, err := gkebackup.NewBackupPlan(ctx, "basic", &gkebackup.BackupPlanArgs{
* Name: pulumi.String("all-groupkinds"),
* Cluster: primary.ID(),
* Location: pulumi.String("us-central1"),
* BackupConfig: &gkebackup.BackupPlanBackupConfigArgs{
* IncludeVolumeData: pulumi.Bool(true),
* IncludeSecrets: pulumi.Bool(true),
* AllNamespaces: pulumi.Bool(true),
* },
* })
* if err != nil {
* return err
* }
* _, err = gkebackup.NewRestorePlan(ctx, "all_cluster_resources", &gkebackup.RestorePlanArgs{
* Name: pulumi.String("all-groupkinds-rp"),
* Location: pulumi.String("us-central1"),
* BackupPlan: basic.ID(),
* Cluster: primary.ID(),
* RestoreConfig: &gkebackup.RestorePlanRestoreConfigArgs{
* NoNamespaces: pulumi.Bool(true),
* NamespacedResourceRestoreMode: pulumi.String("FAIL_ON_CONFLICT"),
* ClusterResourceRestoreScope: &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs{
* AllGroupKinds: pulumi.Bool(true),
* },
* ClusterResourceConflictPolicy: pulumi.String("USE_EXISTING_VERSION"),
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.container.Cluster;
* import com.pulumi.gcp.container.ClusterArgs;
* import com.pulumi.gcp.container.inputs.ClusterWorkloadIdentityConfigArgs;
* import com.pulumi.gcp.container.inputs.ClusterAddonsConfigArgs;
* import com.pulumi.gcp.container.inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs;
* import com.pulumi.gcp.gkebackup.BackupPlan;
* import com.pulumi.gcp.gkebackup.BackupPlanArgs;
* import com.pulumi.gcp.gkebackup.inputs.BackupPlanBackupConfigArgs;
* import com.pulumi.gcp.gkebackup.RestorePlan;
* import com.pulumi.gcp.gkebackup.RestorePlanArgs;
* import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigArgs;
* import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var primary = new Cluster("primary", ClusterArgs.builder()
* .name("all-groupkinds-cluster")
* .location("us-central1")
* .initialNodeCount(1)
* .workloadIdentityConfig(ClusterWorkloadIdentityConfigArgs.builder()
* .workloadPool("my-project-name.svc.id.goog")
* .build())
* .addonsConfig(ClusterAddonsConfigArgs.builder()
* .gkeBackupAgentConfig(ClusterAddonsConfigGkeBackupAgentConfigArgs.builder()
* .enabled(true)
* .build())
* .build())
* .deletionProtection("")
* .network("default")
* .subnetwork("default")
* .build());
* var basic = new BackupPlan("basic", BackupPlanArgs.builder()
* .name("all-groupkinds")
* .cluster(primary.id())
* .location("us-central1")
* .backupConfig(BackupPlanBackupConfigArgs.builder()
* .includeVolumeData(true)
* .includeSecrets(true)
* .allNamespaces(true)
* .build())
* .build());
* var allClusterResources = new RestorePlan("allClusterResources", RestorePlanArgs.builder()
* .name("all-groupkinds-rp")
* .location("us-central1")
* .backupPlan(basic.id())
* .cluster(primary.id())
* .restoreConfig(RestorePlanRestoreConfigArgs.builder()
* .noNamespaces(true)
* .namespacedResourceRestoreMode("FAIL_ON_CONFLICT")
* .clusterResourceRestoreScope(RestorePlanRestoreConfigClusterResourceRestoreScopeArgs.builder()
* .allGroupKinds(true)
* .build())
* .clusterResourceConflictPolicy("USE_EXISTING_VERSION")
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* primary:
* type: gcp:container:Cluster
* properties:
* name: all-groupkinds-cluster
* location: us-central1
* initialNodeCount: 1
* workloadIdentityConfig:
* workloadPool: my-project-name.svc.id.goog
* addonsConfig:
* gkeBackupAgentConfig:
* enabled: true
* deletionProtection:
* network: default
* subnetwork: default
* basic:
* type: gcp:gkebackup:BackupPlan
* properties:
* name: all-groupkinds
* cluster: ${primary.id}
* location: us-central1
* backupConfig:
* includeVolumeData: true
* includeSecrets: true
* allNamespaces: true
* allClusterResources:
* type: gcp:gkebackup:RestorePlan
* name: all_cluster_resources
* properties:
* 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: "",
* 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",
* }],
* },
* ],
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* primary = gcp.container.Cluster("primary",
* name="rename-ns-cluster",
* location="us-central1",
* initial_node_count=1,
* workload_identity_config=gcp.container.ClusterWorkloadIdentityConfigArgs(
* workload_pool="my-project-name.svc.id.goog",
* ),
* addons_config=gcp.container.ClusterAddonsConfigArgs(
* gke_backup_agent_config=gcp.container.ClusterAddonsConfigGkeBackupAgentConfigArgs(
* enabled=True,
* ),
* ),
* deletion_protection="",
* network="default",
* subnetwork="default")
* basic = gcp.gkebackup.BackupPlan("basic",
* name="rename-ns",
* cluster=primary.id,
* location="us-central1",
* backup_config=gcp.gkebackup.BackupPlanBackupConfigArgs(
* include_volume_data=True,
* include_secrets=True,
* all_namespaces=True,
* ))
* rename_ns = gcp.gkebackup.RestorePlan("rename_ns",
* name="rename-ns-rp",
* location="us-central1",
* backup_plan=basic.id,
* cluster=primary.id,
* restore_config=gcp.gkebackup.RestorePlanRestoreConfigArgs(
* selected_namespaces=gcp.gkebackup.RestorePlanRestoreConfigSelectedNamespacesArgs(
* namespaces=["ns1"],
* ),
* namespaced_resource_restore_mode="FAIL_ON_CONFLICT",
* volume_data_restore_policy="REUSE_VOLUME_HANDLE_FROM_BACKUP",
* cluster_resource_restore_scope=gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs(
* no_group_kinds=True,
* ),
* transformation_rules=[
* gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleArgs(
* description="rename namespace from ns1 to ns2",
* resource_filter=gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs(
* group_kinds=[gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArgs(
* resource_kind="Namespace",
* )],
* json_path=".metadata[?(@.name == 'ns1')]",
* ),
* field_actions=[gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArgs(
* op="REPLACE",
* path="/metadata/name",
* value="ns2",
* )],
* ),
* gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleArgs(
* description="move all resources from ns1 to ns2",
* resource_filter=gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs(
* namespaces=["ns1"],
* ),
* field_actions=[gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArgs(
* op="REPLACE",
* path="/metadata/namespace",
* value="ns2",
* )],
* ),
* ],
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var primary = new Gcp.Container.Cluster("primary", new()
* {
* Name = "rename-ns-cluster",
* Location = "us-central1",
* InitialNodeCount = 1,
* WorkloadIdentityConfig = new Gcp.Container.Inputs.ClusterWorkloadIdentityConfigArgs
* {
* WorkloadPool = "my-project-name.svc.id.goog",
* },
* AddonsConfig = new Gcp.Container.Inputs.ClusterAddonsConfigArgs
* {
* GkeBackupAgentConfig = new Gcp.Container.Inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs
* {
* Enabled = true,
* },
* },
* DeletionProtection = "",
* Network = "default",
* Subnetwork = "default",
* });
* var basic = new Gcp.GkeBackup.BackupPlan("basic", new()
* {
* Name = "rename-ns",
* Cluster = primary.Id,
* Location = "us-central1",
* BackupConfig = new Gcp.GkeBackup.Inputs.BackupPlanBackupConfigArgs
* {
* IncludeVolumeData = true,
* IncludeSecrets = true,
* AllNamespaces = true,
* },
* });
* var renameNs = new Gcp.GkeBackup.RestorePlan("rename_ns", new()
* {
* Name = "rename-ns-rp",
* Location = "us-central1",
* BackupPlan = basic.Id,
* Cluster = primary.Id,
* RestoreConfig = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigArgs
* {
* SelectedNamespaces = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigSelectedNamespacesArgs
* {
* Namespaces = new[]
* {
* "ns1",
* },
* },
* NamespacedResourceRestoreMode = "FAIL_ON_CONFLICT",
* VolumeDataRestorePolicy = "REUSE_VOLUME_HANDLE_FROM_BACKUP",
* ClusterResourceRestoreScope = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs
* {
* NoGroupKinds = true,
* },
* TransformationRules = new[]
* {
* new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleArgs
* {
* Description = "rename namespace from ns1 to ns2",
* ResourceFilter = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs
* {
* GroupKinds = new[]
* {
* new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArgs
* {
* ResourceKind = "Namespace",
* },
* },
* JsonPath = ".metadata[?(@.name == 'ns1')]",
* },
* FieldActions = new[]
* {
* new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleFieldActionArgs
* {
* Op = "REPLACE",
* Path = "/metadata/name",
* Value = "ns2",
* },
* },
* },
* new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleArgs
* {
* Description = "move all resources from ns1 to ns2",
* ResourceFilter = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs
* {
* Namespaces = new[]
* {
* "ns1",
* },
* },
* FieldActions = new[]
* {
* new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleFieldActionArgs
* {
* Op = "REPLACE",
* Path = "/metadata/namespace",
* Value = "ns2",
* },
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkebackup"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
* Name: pulumi.String("rename-ns-cluster"),
* Location: pulumi.String("us-central1"),
* InitialNodeCount: pulumi.Int(1),
* WorkloadIdentityConfig: &container.ClusterWorkloadIdentityConfigArgs{
* WorkloadPool: pulumi.String("my-project-name.svc.id.goog"),
* },
* AddonsConfig: &container.ClusterAddonsConfigArgs{
* GkeBackupAgentConfig: &container.ClusterAddonsConfigGkeBackupAgentConfigArgs{
* Enabled: pulumi.Bool(true),
* },
* },
* DeletionProtection: pulumi.Bool(""),
* Network: pulumi.String("default"),
* Subnetwork: pulumi.String("default"),
* })
* if err != nil {
* return err
* }
* basic, err := gkebackup.NewBackupPlan(ctx, "basic", &gkebackup.BackupPlanArgs{
* Name: pulumi.String("rename-ns"),
* Cluster: primary.ID(),
* Location: pulumi.String("us-central1"),
* BackupConfig: &gkebackup.BackupPlanBackupConfigArgs{
* IncludeVolumeData: pulumi.Bool(true),
* IncludeSecrets: pulumi.Bool(true),
* AllNamespaces: pulumi.Bool(true),
* },
* })
* if err != nil {
* return err
* }
* _, err = gkebackup.NewRestorePlan(ctx, "rename_ns", &gkebackup.RestorePlanArgs{
* Name: pulumi.String("rename-ns-rp"),
* Location: pulumi.String("us-central1"),
* BackupPlan: basic.ID(),
* Cluster: primary.ID(),
* RestoreConfig: &gkebackup.RestorePlanRestoreConfigArgs{
* SelectedNamespaces: &gkebackup.RestorePlanRestoreConfigSelectedNamespacesArgs{
* Namespaces: pulumi.StringArray{
* pulumi.String("ns1"),
* },
* },
* NamespacedResourceRestoreMode: pulumi.String("FAIL_ON_CONFLICT"),
* VolumeDataRestorePolicy: pulumi.String("REUSE_VOLUME_HANDLE_FROM_BACKUP"),
* ClusterResourceRestoreScope: &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs{
* NoGroupKinds: pulumi.Bool(true),
* },
* TransformationRules: gkebackup.RestorePlanRestoreConfigTransformationRuleArray{
* &gkebackup.RestorePlanRestoreConfigTransformationRuleArgs{
* Description: pulumi.String("rename namespace from ns1 to ns2"),
* ResourceFilter: &gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs{
* GroupKinds: gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArray{
* &gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArgs{
* ResourceKind: pulumi.String("Namespace"),
* },
* },
* JsonPath: pulumi.String(".metadata[?(@.name == 'ns1')]"),
* },
* FieldActions: gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArray{
* &gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArgs{
* Op: pulumi.String("REPLACE"),
* Path: pulumi.String("/metadata/name"),
* Value: pulumi.String("ns2"),
* },
* },
* },
* &gkebackup.RestorePlanRestoreConfigTransformationRuleArgs{
* Description: pulumi.String("move all resources from ns1 to ns2"),
* ResourceFilter: &gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs{
* Namespaces: pulumi.StringArray{
* pulumi.String("ns1"),
* },
* },
* FieldActions: gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArray{
* &gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArgs{
* Op: pulumi.String("REPLACE"),
* Path: pulumi.String("/metadata/namespace"),
* Value: pulumi.String("ns2"),
* },
* },
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.container.Cluster;
* import com.pulumi.gcp.container.ClusterArgs;
* import com.pulumi.gcp.container.inputs.ClusterWorkloadIdentityConfigArgs;
* import com.pulumi.gcp.container.inputs.ClusterAddonsConfigArgs;
* import com.pulumi.gcp.container.inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs;
* import com.pulumi.gcp.gkebackup.BackupPlan;
* import com.pulumi.gcp.gkebackup.BackupPlanArgs;
* import com.pulumi.gcp.gkebackup.inputs.BackupPlanBackupConfigArgs;
* import com.pulumi.gcp.gkebackup.RestorePlan;
* import com.pulumi.gcp.gkebackup.RestorePlanArgs;
* import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigArgs;
* import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigSelectedNamespacesArgs;
* import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var primary = new Cluster("primary", ClusterArgs.builder()
* .name("rename-ns-cluster")
* .location("us-central1")
* .initialNodeCount(1)
* .workloadIdentityConfig(ClusterWorkloadIdentityConfigArgs.builder()
* .workloadPool("my-project-name.svc.id.goog")
* .build())
* .addonsConfig(ClusterAddonsConfigArgs.builder()
* .gkeBackupAgentConfig(ClusterAddonsConfigGkeBackupAgentConfigArgs.builder()
* .enabled(true)
* .build())
* .build())
* .deletionProtection("")
* .network("default")
* .subnetwork("default")
* .build());
* var basic = new BackupPlan("basic", BackupPlanArgs.builder()
* .name("rename-ns")
* .cluster(primary.id())
* .location("us-central1")
* .backupConfig(BackupPlanBackupConfigArgs.builder()
* .includeVolumeData(true)
* .includeSecrets(true)
* .allNamespaces(true)
* .build())
* .build());
* var renameNs = new RestorePlan("renameNs", RestorePlanArgs.builder()
* .name("rename-ns-rp")
* .location("us-central1")
* .backupPlan(basic.id())
* .cluster(primary.id())
* .restoreConfig(RestorePlanRestoreConfigArgs.builder()
* .selectedNamespaces(RestorePlanRestoreConfigSelectedNamespacesArgs.builder()
* .namespaces("ns1")
* .build())
* .namespacedResourceRestoreMode("FAIL_ON_CONFLICT")
* .volumeDataRestorePolicy("REUSE_VOLUME_HANDLE_FROM_BACKUP")
* .clusterResourceRestoreScope(RestorePlanRestoreConfigClusterResourceRestoreScopeArgs.builder()
* .noGroupKinds(true)
* .build())
* .transformationRules(
* RestorePlanRestoreConfigTransformationRuleArgs.builder()
* .description("rename namespace from ns1 to ns2")
* .resourceFilter(RestorePlanRestoreConfigTransformationRuleResourceFilterArgs.builder()
* .groupKinds(RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArgs.builder()
* .resourceKind("Namespace")
* .build())
* .jsonPath(".metadata[?(@.name == 'ns1')]")
* .build())
* .fieldActions(RestorePlanRestoreConfigTransformationRuleFieldActionArgs.builder()
* .op("REPLACE")
* .path("/metadata/name")
* .value("ns2")
* .build())
* .build(),
* RestorePlanRestoreConfigTransformationRuleArgs.builder()
* .description("move all resources from ns1 to ns2")
* .resourceFilter(RestorePlanRestoreConfigTransformationRuleResourceFilterArgs.builder()
* .namespaces("ns1")
* .build())
* .fieldActions(RestorePlanRestoreConfigTransformationRuleFieldActionArgs.builder()
* .op("REPLACE")
* .path("/metadata/namespace")
* .value("ns2")
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* primary:
* type: gcp:container:Cluster
* properties:
* name: rename-ns-cluster
* location: us-central1
* initialNodeCount: 1
* workloadIdentityConfig:
* workloadPool: my-project-name.svc.id.goog
* addonsConfig:
* gkeBackupAgentConfig:
* enabled: true
* deletionProtection:
* network: default
* subnetwork: default
* basic:
* type: gcp:gkebackup:BackupPlan
* properties:
* name: rename-ns
* cluster: ${primary.id}
* location: us-central1
* backupConfig:
* includeVolumeData: true
* includeSecrets: true
* allNamespaces: true
* renameNs:
* type: gcp:gkebackup:RestorePlan
* name: rename_ns
* properties:
* 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: "",
* 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",
* }],
* }],
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* primary = gcp.container.Cluster("primary",
* name="transform-rule-cluster",
* location="us-central1",
* initial_node_count=1,
* workload_identity_config=gcp.container.ClusterWorkloadIdentityConfigArgs(
* workload_pool="my-project-name.svc.id.goog",
* ),
* addons_config=gcp.container.ClusterAddonsConfigArgs(
* gke_backup_agent_config=gcp.container.ClusterAddonsConfigGkeBackupAgentConfigArgs(
* enabled=True,
* ),
* ),
* deletion_protection="",
* network="default",
* subnetwork="default")
* basic = gcp.gkebackup.BackupPlan("basic",
* name="transform-rule",
* cluster=primary.id,
* location="us-central1",
* backup_config=gcp.gkebackup.BackupPlanBackupConfigArgs(
* include_volume_data=True,
* include_secrets=True,
* all_namespaces=True,
* ))
* transform_rule = gcp.gkebackup.RestorePlan("transform_rule",
* name="transform-rule-rp",
* description="copy nginx env variables",
* labels={
* "app": "nginx",
* },
* location="us-central1",
* backup_plan=basic.id,
* cluster=primary.id,
* restore_config=gcp.gkebackup.RestorePlanRestoreConfigArgs(
* excluded_namespaces=gcp.gkebackup.RestorePlanRestoreConfigExcludedNamespacesArgs(
* namespaces=["my-ns"],
* ),
* namespaced_resource_restore_mode="DELETE_AND_RESTORE",
* volume_data_restore_policy="RESTORE_VOLUME_DATA_FROM_BACKUP",
* cluster_resource_restore_scope=gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs(
* excluded_group_kinds=[gcp.gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeExcludedGroupKindArgs(
* resource_group="apiextension.k8s.io",
* resource_kind="CustomResourceDefinition",
* )],
* ),
* cluster_resource_conflict_policy="USE_EXISTING_VERSION",
* transformation_rules=[gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleArgs(
* description="Copy environment variables from the nginx container to the install init container.",
* resource_filter=gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs(
* group_kinds=[gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArgs(
* resource_kind="Pod",
* resource_group="",
* )],
* json_path=".metadata[?(@.name == 'nginx')]",
* ),
* field_actions=[gcp.gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArgs(
* op="COPY",
* path="/spec/initContainers/0/env",
* from_path="/spec/containers/0/env",
* )],
* )],
* ))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var primary = new Gcp.Container.Cluster("primary", new()
* {
* Name = "transform-rule-cluster",
* Location = "us-central1",
* InitialNodeCount = 1,
* WorkloadIdentityConfig = new Gcp.Container.Inputs.ClusterWorkloadIdentityConfigArgs
* {
* WorkloadPool = "my-project-name.svc.id.goog",
* },
* AddonsConfig = new Gcp.Container.Inputs.ClusterAddonsConfigArgs
* {
* GkeBackupAgentConfig = new Gcp.Container.Inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs
* {
* Enabled = true,
* },
* },
* DeletionProtection = "",
* Network = "default",
* Subnetwork = "default",
* });
* var basic = new Gcp.GkeBackup.BackupPlan("basic", new()
* {
* Name = "transform-rule",
* Cluster = primary.Id,
* Location = "us-central1",
* BackupConfig = new Gcp.GkeBackup.Inputs.BackupPlanBackupConfigArgs
* {
* IncludeVolumeData = true,
* IncludeSecrets = true,
* AllNamespaces = true,
* },
* });
* var transformRule = new Gcp.GkeBackup.RestorePlan("transform_rule", new()
* {
* Name = "transform-rule-rp",
* Description = "copy nginx env variables",
* Labels =
* {
* { "app", "nginx" },
* },
* Location = "us-central1",
* BackupPlan = basic.Id,
* Cluster = primary.Id,
* RestoreConfig = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigArgs
* {
* ExcludedNamespaces = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigExcludedNamespacesArgs
* {
* Namespaces = new[]
* {
* "my-ns",
* },
* },
* NamespacedResourceRestoreMode = "DELETE_AND_RESTORE",
* VolumeDataRestorePolicy = "RESTORE_VOLUME_DATA_FROM_BACKUP",
* ClusterResourceRestoreScope = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs
* {
* ExcludedGroupKinds = new[]
* {
* new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeExcludedGroupKindArgs
* {
* ResourceGroup = "apiextension.k8s.io",
* ResourceKind = "CustomResourceDefinition",
* },
* },
* },
* ClusterResourceConflictPolicy = "USE_EXISTING_VERSION",
* TransformationRules = new[]
* {
* new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleArgs
* {
* Description = "Copy environment variables from the nginx container to the install init container.",
* ResourceFilter = new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs
* {
* GroupKinds = new[]
* {
* new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArgs
* {
* ResourceKind = "Pod",
* ResourceGroup = "",
* },
* },
* JsonPath = ".metadata[?(@.name == 'nginx')]",
* },
* FieldActions = new[]
* {
* new Gcp.GkeBackup.Inputs.RestorePlanRestoreConfigTransformationRuleFieldActionArgs
* {
* Op = "COPY",
* Path = "/spec/initContainers/0/env",
* FromPath = "/spec/containers/0/env",
* },
* },
* },
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/container"
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/gkebackup"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* primary, err := container.NewCluster(ctx, "primary", &container.ClusterArgs{
* Name: pulumi.String("transform-rule-cluster"),
* Location: pulumi.String("us-central1"),
* InitialNodeCount: pulumi.Int(1),
* WorkloadIdentityConfig: &container.ClusterWorkloadIdentityConfigArgs{
* WorkloadPool: pulumi.String("my-project-name.svc.id.goog"),
* },
* AddonsConfig: &container.ClusterAddonsConfigArgs{
* GkeBackupAgentConfig: &container.ClusterAddonsConfigGkeBackupAgentConfigArgs{
* Enabled: pulumi.Bool(true),
* },
* },
* DeletionProtection: pulumi.Bool(""),
* Network: pulumi.String("default"),
* Subnetwork: pulumi.String("default"),
* })
* if err != nil {
* return err
* }
* basic, err := gkebackup.NewBackupPlan(ctx, "basic", &gkebackup.BackupPlanArgs{
* Name: pulumi.String("transform-rule"),
* Cluster: primary.ID(),
* Location: pulumi.String("us-central1"),
* BackupConfig: &gkebackup.BackupPlanBackupConfigArgs{
* IncludeVolumeData: pulumi.Bool(true),
* IncludeSecrets: pulumi.Bool(true),
* AllNamespaces: pulumi.Bool(true),
* },
* })
* if err != nil {
* return err
* }
* _, err = gkebackup.NewRestorePlan(ctx, "transform_rule", &gkebackup.RestorePlanArgs{
* Name: pulumi.String("transform-rule-rp"),
* Description: pulumi.String("copy nginx env variables"),
* Labels: pulumi.StringMap{
* "app": pulumi.String("nginx"),
* },
* Location: pulumi.String("us-central1"),
* BackupPlan: basic.ID(),
* Cluster: primary.ID(),
* RestoreConfig: &gkebackup.RestorePlanRestoreConfigArgs{
* ExcludedNamespaces: &gkebackup.RestorePlanRestoreConfigExcludedNamespacesArgs{
* Namespaces: pulumi.StringArray{
* pulumi.String("my-ns"),
* },
* },
* NamespacedResourceRestoreMode: pulumi.String("DELETE_AND_RESTORE"),
* VolumeDataRestorePolicy: pulumi.String("RESTORE_VOLUME_DATA_FROM_BACKUP"),
* ClusterResourceRestoreScope: &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs{
* ExcludedGroupKinds: gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeExcludedGroupKindArray{
* &gkebackup.RestorePlanRestoreConfigClusterResourceRestoreScopeExcludedGroupKindArgs{
* ResourceGroup: pulumi.String("apiextension.k8s.io"),
* ResourceKind: pulumi.String("CustomResourceDefinition"),
* },
* },
* },
* ClusterResourceConflictPolicy: pulumi.String("USE_EXISTING_VERSION"),
* TransformationRules: gkebackup.RestorePlanRestoreConfigTransformationRuleArray{
* &gkebackup.RestorePlanRestoreConfigTransformationRuleArgs{
* Description: pulumi.String("Copy environment variables from the nginx container to the install init container."),
* ResourceFilter: &gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterArgs{
* GroupKinds: gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArray{
* &gkebackup.RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArgs{
* ResourceKind: pulumi.String("Pod"),
* ResourceGroup: pulumi.String(""),
* },
* },
* JsonPath: pulumi.String(".metadata[?(@.name == 'nginx')]"),
* },
* FieldActions: gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArray{
* &gkebackup.RestorePlanRestoreConfigTransformationRuleFieldActionArgs{
* Op: pulumi.String("COPY"),
* Path: pulumi.String("/spec/initContainers/0/env"),
* FromPath: pulumi.String("/spec/containers/0/env"),
* },
* },
* },
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.gcp.container.Cluster;
* import com.pulumi.gcp.container.ClusterArgs;
* import com.pulumi.gcp.container.inputs.ClusterWorkloadIdentityConfigArgs;
* import com.pulumi.gcp.container.inputs.ClusterAddonsConfigArgs;
* import com.pulumi.gcp.container.inputs.ClusterAddonsConfigGkeBackupAgentConfigArgs;
* import com.pulumi.gcp.gkebackup.BackupPlan;
* import com.pulumi.gcp.gkebackup.BackupPlanArgs;
* import com.pulumi.gcp.gkebackup.inputs.BackupPlanBackupConfigArgs;
* import com.pulumi.gcp.gkebackup.RestorePlan;
* import com.pulumi.gcp.gkebackup.RestorePlanArgs;
* import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigArgs;
* import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigExcludedNamespacesArgs;
* import com.pulumi.gcp.gkebackup.inputs.RestorePlanRestoreConfigClusterResourceRestoreScopeArgs;
* import java.util.List;
* import java.util.ArrayList;
* import java.util.Map;
* import java.io.File;
* import java.nio.file.Files;
* import java.nio.file.Paths;
* public class App {
* public static void main(String[] args) {
* Pulumi.run(App::stack);
* }
* public static void stack(Context ctx) {
* var primary = new Cluster("primary", ClusterArgs.builder()
* .name("transform-rule-cluster")
* .location("us-central1")
* .initialNodeCount(1)
* .workloadIdentityConfig(ClusterWorkloadIdentityConfigArgs.builder()
* .workloadPool("my-project-name.svc.id.goog")
* .build())
* .addonsConfig(ClusterAddonsConfigArgs.builder()
* .gkeBackupAgentConfig(ClusterAddonsConfigGkeBackupAgentConfigArgs.builder()
* .enabled(true)
* .build())
* .build())
* .deletionProtection("")
* .network("default")
* .subnetwork("default")
* .build());
* var basic = new BackupPlan("basic", BackupPlanArgs.builder()
* .name("transform-rule")
* .cluster(primary.id())
* .location("us-central1")
* .backupConfig(BackupPlanBackupConfigArgs.builder()
* .includeVolumeData(true)
* .includeSecrets(true)
* .allNamespaces(true)
* .build())
* .build());
* var transformRule = new RestorePlan("transformRule", RestorePlanArgs.builder()
* .name("transform-rule-rp")
* .description("copy nginx env variables")
* .labels(Map.of("app", "nginx"))
* .location("us-central1")
* .backupPlan(basic.id())
* .cluster(primary.id())
* .restoreConfig(RestorePlanRestoreConfigArgs.builder()
* .excludedNamespaces(RestorePlanRestoreConfigExcludedNamespacesArgs.builder()
* .namespaces("my-ns")
* .build())
* .namespacedResourceRestoreMode("DELETE_AND_RESTORE")
* .volumeDataRestorePolicy("RESTORE_VOLUME_DATA_FROM_BACKUP")
* .clusterResourceRestoreScope(RestorePlanRestoreConfigClusterResourceRestoreScopeArgs.builder()
* .excludedGroupKinds(RestorePlanRestoreConfigClusterResourceRestoreScopeExcludedGroupKindArgs.builder()
* .resourceGroup("apiextension.k8s.io")
* .resourceKind("CustomResourceDefinition")
* .build())
* .build())
* .clusterResourceConflictPolicy("USE_EXISTING_VERSION")
* .transformationRules(RestorePlanRestoreConfigTransformationRuleArgs.builder()
* .description("Copy environment variables from the nginx container to the install init container.")
* .resourceFilter(RestorePlanRestoreConfigTransformationRuleResourceFilterArgs.builder()
* .groupKinds(RestorePlanRestoreConfigTransformationRuleResourceFilterGroupKindArgs.builder()
* .resourceKind("Pod")
* .resourceGroup("")
* .build())
* .jsonPath(".metadata[?(@.name == 'nginx')]")
* .build())
* .fieldActions(RestorePlanRestoreConfigTransformationRuleFieldActionArgs.builder()
* .op("COPY")
* .path("/spec/initContainers/0/env")
* .fromPath("/spec/containers/0/env")
* .build())
* .build())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* primary:
* type: gcp:container:Cluster
* properties:
* name: transform-rule-cluster
* location: us-central1
* initialNodeCount: 1
* workloadIdentityConfig:
* workloadPool: my-project-name.svc.id.goog
* addonsConfig:
* gkeBackupAgentConfig:
* enabled: true
* deletionProtection:
* network: default
* subnetwork: default
* basic:
* type: gcp:gkebackup:BackupPlan
* properties:
* name: transform-rule
* cluster: ${primary.id}
* location: us-central1
* backupConfig:
* includeVolumeData: true
* includeSecrets: true
* allNamespaces: true
* transformRule:
* type: gcp:gkebackup:RestorePlan
* name: transform_rule
* properties:
* 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
* ```
*
* ## 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/restorePlanIamBinding:RestorePlanIamBinding default projects/{{project}}/locations/{{location}}/restorePlans/{{name}}
* ```
* ```sh
* $ pulumi import gcp:gkebackup/restorePlanIamBinding:RestorePlanIamBinding default {{project}}/{{location}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:gkebackup/restorePlanIamBinding:RestorePlanIamBinding default {{location}}/{{name}}
* ```
*/
public class RestorePlanIamBinding internal constructor(
override val javaResource: com.pulumi.gcp.gkebackup.RestorePlanIamBinding,
) : KotlinCustomResource(javaResource, RestorePlanIamBindingMapper) {
public val condition: Output?
get() = javaResource.condition().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
toKotlin(args0)
})
}).orElse(null)
})
public val etag: Output
get() = javaResource.etag().applyValue({ args0 -> args0 })
/**
* The region of the Restore Plan.
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
public val members: Output>
get() = javaResource.members().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
/**
* The full name of the BackupPlan Resource.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
public val role: Output
get() = javaResource.role().applyValue({ args0 -> args0 })
}
public object RestorePlanIamBindingMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.gkebackup.RestorePlanIamBinding::class == javaResource::class
override fun map(javaResource: Resource): RestorePlanIamBinding =
RestorePlanIamBinding(javaResource as com.pulumi.gcp.gkebackup.RestorePlanIamBinding)
}
/**
* @see [RestorePlanIamBinding].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [RestorePlanIamBinding].
*/
public suspend fun restorePlanIamBinding(
name: String,
block: suspend RestorePlanIamBindingResourceBuilder.() -> Unit,
): RestorePlanIamBinding {
val builder = RestorePlanIamBindingResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [RestorePlanIamBinding].
* @param name The _unique_ name of the resulting resource.
*/
public fun restorePlanIamBinding(name: String): RestorePlanIamBinding {
val builder = RestorePlanIamBindingResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy