From 5a186d8453b304764c96f534aeb079b9df8da7ba Mon Sep 17 00:00:00 2001 From: Harshita1603 <45848384+Harshita1603@users.noreply.github.com> Date: Wed, 3 Apr 2024 20:10:15 +0000 Subject: [PATCH 01/14] Add DeletionProtectionEnabled to Redis Cluster --- mmv1/products/redis/Cluster.yaml | 12 +++++++++--- .../terraform/examples/redis_cluster_ha.tf.erb | 5 +---- .../redis/resource_redis_cluster_test.go.erb | 13 +++---------- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/mmv1/products/redis/Cluster.yaml b/mmv1/products/redis/Cluster.yaml index d815eb7b9a0a..55d2ba68a52f 100644 --- a/mmv1/products/redis/Cluster.yaml +++ b/mmv1/products/redis/Cluster.yaml @@ -57,11 +57,11 @@ examples: policy_name: "mypolicy" subnet_name: "mysubnet" network_name: "mynetwork" - prevent_destroy: 'true' + deletion_protection_enabled: 'true' test_vars_overrides: - prevent_destroy: 'false' + deletion_protection_enabled: 'false' oics_vars_overrides: - prevent_destroy: 'false' + deletion_protection_enabled: 'false' properties: - !ruby/object:Api::Type::Time name: createTime @@ -231,3 +231,9 @@ properties: description: | Required. Number of shards for the Redis cluster. required: true + - !ruby/object:Api::Type::Boolean + name: deletionProtectionEnabled + description: | + Optional. Indicates if the cluster is deletion protected or not. Default value is true. + required: false + default_value: true \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/redis_cluster_ha.tf.erb b/mmv1/templates/terraform/examples/redis_cluster_ha.tf.erb index 24273a469e55..e776876ae60d 100644 --- a/mmv1/templates/terraform/examples/redis_cluster_ha.tf.erb +++ b/mmv1/templates/terraform/examples/redis_cluster_ha.tf.erb @@ -9,13 +9,10 @@ resource "google_redis_cluster" "<%= ctx[:primary_resource_id] %>" { node_type = "REDIS_SHARED_CORE_NANO" transit_encryption_mode = "TRANSIT_ENCRYPTION_MODE_DISABLED" authorization_mode = "AUTH_MODE_DISABLED" + deletion_protection_enabled = <%= ctx[:vars]['deletion_protection_enabled'] == 'true' %> depends_on = [ google_network_connectivity_service_connection_policy.default ] - - lifecycle { - prevent_destroy = <%= ctx[:vars]['prevent_destroy'] %> - } } resource "google_network_connectivity_service_connection_policy" "default" { diff --git a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb index 928eb49c857c..381f040357ef 100644 --- a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb +++ b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb @@ -131,14 +131,7 @@ func TestAccRedisCluster_updateShardCount(t *testing.T) { }) } -func createOrUpdateRedisCluster(name string, replicaCount int, shardCount int, preventDestroy bool, nodeType string) string { - lifecycleBlock := "" - if preventDestroy { - lifecycleBlock = ` - lifecycle { - prevent_destroy = true - }` - } +func createOrUpdateRedisCluster(name string, replicaCount int, shardCount int, deletionProtectionEnabled bool, nodeType string) string { return fmt.Sprintf(` resource "google_redis_cluster" "test" { provider = google-beta @@ -146,6 +139,7 @@ resource "google_redis_cluster" "test" { replica_count = %d shard_count = %d node_type = "%s" + deletion_protection_enabled = %v region = "us-central1" psc_configs { network = google_compute_network.producer_net.id @@ -153,7 +147,6 @@ resource "google_redis_cluster" "test" { depends_on = [ google_network_connectivity_service_connection_policy.default ] - %s } resource "google_network_connectivity_service_connection_policy" "default" { @@ -181,6 +174,6 @@ resource "google_compute_network" "producer_net" { name = "%s" auto_create_subnetworks = false } -`, name, replicaCount, shardCount, nodeType, lifecycleBlock, name, name, name) +`, name, replicaCount, shardCount, nodeType, deletionProtectionEnabled, name, name, name) } <% end -%> From ca7fceb1dad3301c8e1e8831fa48645933573338 Mon Sep 17 00:00:00 2001 From: Harshita1603 <45848384+Harshita1603@users.noreply.github.com> Date: Thu, 4 Apr 2024 11:31:46 +0000 Subject: [PATCH 02/14] Add a new line character at the end of Cluster.yaml --- mmv1/products/redis/Cluster.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/redis/Cluster.yaml b/mmv1/products/redis/Cluster.yaml index 55d2ba68a52f..c8f2d8d61516 100644 --- a/mmv1/products/redis/Cluster.yaml +++ b/mmv1/products/redis/Cluster.yaml @@ -236,4 +236,4 @@ properties: description: | Optional. Indicates if the cluster is deletion protected or not. Default value is true. required: false - default_value: true \ No newline at end of file + default_value: true From 0dba36e571aeea29d859dda3ad318fa72cf8cb07 Mon Sep 17 00:00:00 2001 From: Harshita1603 <45848384+Harshita1603@users.noreply.github.com> Date: Fri, 5 Apr 2024 18:42:06 +0000 Subject: [PATCH 03/14] set deletion protection to false before resource cleanup --- .../redis/resource_redis_cluster_test.go.erb | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb index 381f040357ef..e0c0a9e0c0ac 100644 --- a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb +++ b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb @@ -30,6 +30,16 @@ func TestAccRedisCluster_createClusterWithNodeType(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"psc_configs"}, }, + { + // set deletion protection to false + Config: createOrUpdateRedisCluster(name, /* replicaCount = */ 0, /* shardCount = */ 3, false, /*nodeType = */ "REDIS_STANDARD_SMALL"), + }, + { + ResourceName: "google_redis_cluster.test", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"psc_configs"}, + }, { // clean up the resource Config: createOrUpdateRedisCluster(name, /* replicaCount = */ 0, /* shardCount = */ 3, false, /*nodeType = */ "REDIS_STANDARD_SMALL"), @@ -69,6 +79,16 @@ func TestAccRedisCluster_updateReplicaCount(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"psc_configs"}, }, + { + // set deletion protection to false + Config: createOrUpdateRedisCluster(name, /* replicaCount = */ 2, /* shardCount = */ 3, false, /*nodeType = */ ""), + }, + { + ResourceName: "google_redis_cluster.test", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"psc_configs"}, + }, { // clean up the resource Config: createOrUpdateRedisCluster(name, /* replicaCount = */ 2, /* shardCount = */ 3, false, /*nodeType = */ ""), @@ -83,6 +103,16 @@ func TestAccRedisCluster_updateReplicaCount(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"psc_configs"}, }, + { + // set deletion protection to false + Config: createOrUpdateRedisCluster(name /* replicaCount = */, 0 /* shardCount = */, 3, false, /*nodeType = */ ""), + }, + { + ResourceName: "google_redis_cluster.test", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"psc_configs"}, + }, { // clean up the resource Config: createOrUpdateRedisCluster(name /* replicaCount = */, 0 /* shardCount = */, 3, false, /*nodeType = */ ""), @@ -123,6 +153,16 @@ func TestAccRedisCluster_updateShardCount(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"psc_configs"}, }, + { + // set deletion protection to false + Config: createOrUpdateRedisCluster(name /* replicaCount = */, 1 /* shardCount = */, 5, false, /* nodeType = */ ""), + }, + { + ResourceName: "google_redis_cluster.test", + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"psc_configs"}, + }, { // clean up the resource Config: createOrUpdateRedisCluster(name /* replicaCount = */, 1 /* shardCount = */, 5, false, /* nodeType = */ ""), From c5716aa7ff870300512d0e81616e152cbefe904f Mon Sep 17 00:00:00 2001 From: Harshita1603 <45848384+Harshita1603@users.noreply.github.com> Date: Tue, 23 Apr 2024 07:16:35 +0000 Subject: [PATCH 04/14] Modify failing tests --- .../redis/resource_redis_cluster_test.go.erb | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb index e0c0a9e0c0ac..c0b210310289 100644 --- a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb +++ b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb @@ -32,7 +32,7 @@ func TestAccRedisCluster_createClusterWithNodeType(t *testing.T) { }, { // set deletion protection to false - Config: createOrUpdateRedisCluster(name, /* replicaCount = */ 0, /* shardCount = */ 3, false, /*nodeType = */ "REDIS_STANDARD_SMALL"), + Config: createOrUpdateRedisCluster(name, /* replicaCount = */ 1, /* shardCount = */ 3, false, /*nodeType = */ "REDIS_STANDARD_SMALL"), }, { ResourceName: "google_redis_cluster.test", @@ -42,7 +42,7 @@ func TestAccRedisCluster_createClusterWithNodeType(t *testing.T) { }, { // clean up the resource - Config: createOrUpdateRedisCluster(name, /* replicaCount = */ 0, /* shardCount = */ 3, false, /*nodeType = */ "REDIS_STANDARD_SMALL"), + Config: createOrUpdateRedisCluster(name, /* replicaCount = */ 1, /* shardCount = */ 3, false, /*nodeType = */ "REDIS_STANDARD_SMALL"), }, }, }) @@ -79,20 +79,6 @@ func TestAccRedisCluster_updateReplicaCount(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"psc_configs"}, }, - { - // set deletion protection to false - Config: createOrUpdateRedisCluster(name, /* replicaCount = */ 2, /* shardCount = */ 3, false, /*nodeType = */ ""), - }, - { - ResourceName: "google_redis_cluster.test", - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"psc_configs"}, - }, - { - // clean up the resource - Config: createOrUpdateRedisCluster(name, /* replicaCount = */ 2, /* shardCount = */ 3, false, /*nodeType = */ ""), - }, { // update replica count to 0 Config: createOrUpdateRedisCluster(name, /* replicaCount = */ 0, /* shardCount = */ 3, true, /*nodeType = */ ""), From 1fa2878fa263a3ade7ee4c78584e265707dffa09 Mon Sep 17 00:00:00 2001 From: Harshita1603 <45848384+Harshita1603@users.noreply.github.com> Date: Mon, 29 Apr 2024 11:52:21 +0000 Subject: [PATCH 05/14] Modify field description --- mmv1/products/redis/Cluster.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mmv1/products/redis/Cluster.yaml b/mmv1/products/redis/Cluster.yaml index c8f2d8d61516..3fbe25f24201 100644 --- a/mmv1/products/redis/Cluster.yaml +++ b/mmv1/products/redis/Cluster.yaml @@ -234,6 +234,8 @@ properties: - !ruby/object:Api::Type::Boolean name: deletionProtectionEnabled description: | - Optional. Indicates if the cluster is deletion protected or not. Default value is true. + Optional. Indicates if the cluster is deletion protected or not. + If the value if set to true, any delete cluster operation will fail. + Default value is true. required: false default_value: true From 4ec46dc783517b5df3743b1a8b05c4ecfc67452a Mon Sep 17 00:00:00 2001 From: Harshita1603 <45848384+Harshita1603@users.noreply.github.com> Date: Mon, 29 Apr 2024 12:20:23 +0000 Subject: [PATCH 06/14] Resolve Lint errors --- mmv1/products/redis/Cluster.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mmv1/products/redis/Cluster.yaml b/mmv1/products/redis/Cluster.yaml index 38feec960a7f..739af620d363 100644 --- a/mmv1/products/redis/Cluster.yaml +++ b/mmv1/products/redis/Cluster.yaml @@ -234,9 +234,9 @@ properties: - !ruby/object:Api::Type::Boolean name: deletionProtectionEnabled description: | - Optional. Indicates if the cluster is deletion protected or not. - If the value if set to true, any delete cluster operation will fail. - Default value is true. + Optional. Indicates if the cluster is deletion protected or not. + If the value if set to true, any delete cluster operation will fail. + Default value is true. required: false default_value: true - !ruby/object:Api::Type::KeyValuePairs From b2414327b276bb62a48219f181681415ba8cbd36 Mon Sep 17 00:00:00 2001 From: Harshita1603 <45848384+Harshita1603@users.noreply.github.com> Date: Mon, 29 Apr 2024 12:30:07 +0000 Subject: [PATCH 07/14] Add missing character ',' --- .../services/redis/resource_redis_cluster_test.go.erb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb index 07249a83ec0c..54072f3a0aeb 100644 --- a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb +++ b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb @@ -192,7 +192,7 @@ func TestAccRedisCluster_createUpdateDeletionProtection(t *testing.T) { Steps: []resource.TestStep{ { // create cluster with deletion protection set to false - Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: false}) + Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: false}), }, { ResourceName: "google_redis_cluster.test", @@ -202,7 +202,7 @@ func TestAccRedisCluster_createUpdateDeletionProtection(t *testing.T) { }, { // update deletion protection to true - Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: true}) + Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: true}), }, { ResourceName: "google_redis_cluster.test", @@ -212,7 +212,7 @@ func TestAccRedisCluster_createUpdateDeletionProtection(t *testing.T) { }, { // update deletion protection to false and delete the cluster - Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: false}) + Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: false}), }, }, From 3ebe74f4162a14cdbe42eba80e9994e2363d649b Mon Sep 17 00:00:00 2001 From: Harshita1603 <45848384+Harshita1603@users.noreply.github.com> Date: Mon, 29 Apr 2024 13:03:46 +0000 Subject: [PATCH 08/14] Modify deletionProtectionEnabled field in createOrUpdateRedisCluster --- .../terraform/services/redis/resource_redis_cluster_test.go.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb index 54072f3a0aeb..11058b1823de 100644 --- a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb +++ b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb @@ -279,7 +279,7 @@ resource "google_compute_network" "producer_net" { name = "%s" auto_create_subnetworks = false } -`, params.name, params.replicaCount, params.shardCount, params.nodeType, strBuilder.String(), params.deletionProtectionEnabled, params.name, params.name, params.name) +`, params.name, params.replicaCount, params.shardCount, params.nodeType, params.deletionProtectionEnabled, strBuilder.String(), params.name, params.name, params.name) } <% end -%> From c9cbb8c30783e9855597adcbd769cd42552620bf Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Fri, 16 Aug 2024 12:25:43 -0700 Subject: [PATCH 09/14] Update resource_redis_cluster_test.go.erb --- .../terraform/services/redis/resource_redis_cluster_test.go.erb | 1 - 1 file changed, 1 deletion(-) diff --git a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb index 7f84298612f1..5c6ab33ff717 100644 --- a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb +++ b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb @@ -101,7 +101,6 @@ func TestAccRedisCluster_updateReplicaCount(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{"psc_configs"}, }, - { { // update replica count to 0 Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: true, zoneDistributionMode: "MULTI_ZONE"}), From e23623e9870dfd49299f0746d926a0bd723bb1e6 Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Fri, 16 Aug 2024 13:46:57 -0700 Subject: [PATCH 10/14] Update resource_redis_cluster_test.go.erb --- .../services/redis/resource_redis_cluster_test.go.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb index 5c6ab33ff717..370ee15dd1db 100644 --- a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb +++ b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb @@ -54,7 +54,7 @@ func TestAccRedisCluster_createClusterWithZoneDistribution(t *testing.T) { Steps: []resource.TestStep{ { // create cluster with replica count 1 - Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, preventDestroy: false, zoneDistributionMode: "SINGLE_ZONE", zone: "us-central1-b"}), + Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: false, zoneDistributionMode: "SINGLE_ZONE", zone: "us-central1-b"}), }, { ResourceName: "google_redis_cluster.test", @@ -64,7 +64,7 @@ func TestAccRedisCluster_createClusterWithZoneDistribution(t *testing.T) { }, { // clean up the resource - Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, preventDestroy: false, zoneDistributionMode: "SINGLE_ZONE", zone: "us-central1-b"}), + Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: false, zoneDistributionMode: "SINGLE_ZONE", zone: "us-central1-b"}), }, }, }) From 743b7215ca4f59ad147d957a86dda46be8267e23 Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Fri, 16 Aug 2024 15:42:29 -0700 Subject: [PATCH 11/14] Update resource_redis_cluster_test.go.erb --- .../services/redis/resource_redis_cluster_test.go.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb index 370ee15dd1db..97352b7dfb0b 100644 --- a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb +++ b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb @@ -34,7 +34,7 @@ func TestAccRedisCluster_createClusterWithNodeType(t *testing.T) { }, { // clean up the resource - Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: false, nodeType: "REDIS_STANDARD_SMALL", zoneDistributionMode: "MULTI_ZONE"}), + Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 1, shardCount: 3, deletionProtectionEnabled: false, nodeType: "REDIS_STANDARD_SMALL", zoneDistributionMode: "MULTI_ZONE"}), }, }, }) @@ -224,7 +224,7 @@ func TestAccRedisCluster_createUpdateDeletionProtection(t *testing.T) { Steps: []resource.TestStep{ { // create cluster with deletion protection set to false - Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: false}), + Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: false, zoneDistributionMode: "MULTI_ZONE"}), }, { ResourceName: "google_redis_cluster.test", @@ -234,7 +234,7 @@ func TestAccRedisCluster_createUpdateDeletionProtection(t *testing.T) { }, { // update deletion protection to true - Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: true}), + Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: true, zoneDistributionMode: "MULTI_ZONE"}), }, { ResourceName: "google_redis_cluster.test", @@ -244,7 +244,7 @@ func TestAccRedisCluster_createUpdateDeletionProtection(t *testing.T) { }, { // update deletion protection to false and delete the cluster - Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: false}), + Config: createOrUpdateRedisCluster(&ClusterParams{name: name, replicaCount: 0, shardCount: 3, deletionProtectionEnabled: false, zoneDistributionMode: "MULTI_ZONE"}), }, }, From 95a4c6c47da2f9a7318fe9d8c3744ef4a4b1e91d Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Fri, 16 Aug 2024 15:45:36 -0700 Subject: [PATCH 12/14] Update redis_cluster_ha_single_zone.tf.erb --- .../terraform/examples/redis_cluster_ha_single_zone.tf.erb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mmv1/templates/terraform/examples/redis_cluster_ha_single_zone.tf.erb b/mmv1/templates/terraform/examples/redis_cluster_ha_single_zone.tf.erb index 63c7b20f5f81..8ff059978093 100644 --- a/mmv1/templates/terraform/examples/redis_cluster_ha_single_zone.tf.erb +++ b/mmv1/templates/terraform/examples/redis_cluster_ha_single_zone.tf.erb @@ -9,13 +9,11 @@ resource "google_redis_cluster" "<%= ctx[:primary_resource_id] %>" { mode = "SINGLE_ZONE" zone = "us-central1-f" } + deletion_protection_enabled = <%= ctx[:vars]['deletion_protection_enabled'] == 'true' %> depends_on = [ google_network_connectivity_service_connection_policy.default ] - lifecycle { - prevent_destroy = <%= ctx[:vars]['prevent_destroy'] %> - } } resource "google_network_connectivity_service_connection_policy" "default" { From 36d0020e05cda8a836a599a9c0ca0f487dd363ac Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Fri, 16 Aug 2024 15:46:11 -0700 Subject: [PATCH 13/14] Update Cluster.yaml --- mmv1/products/redis/Cluster.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/redis/Cluster.yaml b/mmv1/products/redis/Cluster.yaml index 46d8a7688d98..c3a229daccd0 100644 --- a/mmv1/products/redis/Cluster.yaml +++ b/mmv1/products/redis/Cluster.yaml @@ -70,7 +70,7 @@ examples: policy_name: "mypolicy" subnet_name: "mysubnet" network_name: "mynetwork" - prevent_destroy: 'true' + deletion_protection_enabled: 'true' test_vars_overrides: deletion_protection_enabled: 'false' oics_vars_overrides: From a72c0e14a703d5d87598c94eb0ace373e30dc93e Mon Sep 17 00:00:00 2001 From: Nick Elliot Date: Fri, 16 Aug 2024 16:30:39 -0700 Subject: [PATCH 14/14] Apply suggestions from code review --- .../terraform/services/redis/resource_redis_cluster_test.go.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb index 97352b7dfb0b..682d806d5448 100644 --- a/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb +++ b/mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go.erb @@ -286,7 +286,7 @@ resource "google_redis_cluster" "test" { shard_count = %d node_type = "%s" deletion_protection_enabled = %v - region = "us-central1" + region = "us-central1" psc_configs { network = google_compute_network.producer_net.id }