Skip to content

Commit 7889a12

Browse files
authored
Adding maintenance_version to Redis cluster and Memorystore Instance (#15387)
1 parent 87fe305 commit 7889a12

File tree

5 files changed

+159
-1
lines changed

5 files changed

+159
-1
lines changed

mmv1/products/memorystore/Instance.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,16 @@ properties:
480480
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond
481481
resolution and up to nine fractional digits.
482482
output: true
483+
- name: 'maintenanceVersion'
484+
type: String
485+
description: |
486+
This field can be used to trigger self service update to indicate the desired maintenance version. The input to this field can be determined by the available_maintenance_versions field.
487+
*Note*: This field can only be specified when updating an existing cluster to a newer version. Downgrades are currently not supported!
488+
- name: 'effectiveMaintenanceVersion'
489+
type: String
490+
description: |
491+
This field represents the actual maintenance version of the cluster.
492+
output: true
483493
- name: 'engineVersion'
484494
type: String
485495
description: "Optional. Engine version of the instance."

mmv1/products/redis/Cluster.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,16 @@ properties:
689689
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond
690690
resolution and up to nine fractional digits.
691691
output: true
692+
- name: 'maintenanceVersion'
693+
type: String
694+
description: |
695+
This field can be used to trigger self service update to indicate the desired maintenance version. The input to this field can be determined by the available_maintenance_versions field.
696+
*Note*: This field can only be specified when updating an existing cluster to a newer version. Downgrades are currently not supported!
697+
- name: 'effectiveMaintenanceVersion'
698+
type: String
699+
description: |
700+
This field represents the actual maintenance version of the cluster.
701+
output: true
692702
- name: 'crossClusterReplicationConfig'
693703
type: NestedObject
694704
description: Cross cluster replication config

mmv1/templates/terraform/examples/memorystore_instance_full.tf.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,4 @@ resource "google_compute_network" "producer_net" {
7575
}
7676

7777
data "google_project" "project" {
78-
}
78+
}

mmv1/third_party/terraform/services/memorystore/resource_memorystore_instance_test.go

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,3 +1770,64 @@ data "google_project" "project" {
17701770
}
17711771
`, context)
17721772
}
1773+
1774+
func TestAccMemorystoreInstance_memorystoreInstanceMaintenanceVersion(t *testing.T) {
1775+
t.Parallel()
1776+
1777+
context := map[string]interface{}{
1778+
"random_suffix": acctest.RandString(t, 10),
1779+
"location": "us-central1",
1780+
}
1781+
1782+
acctest.VcrTest(t, resource.TestCase{
1783+
PreCheck: func() { acctest.AccTestPreCheck(t) },
1784+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
1785+
CheckDestroy: testAccCheckMemorystoreInstanceDestroyProducer(t),
1786+
Steps: []resource.TestStep{
1787+
{
1788+
Config: testAccMemorystoreInstance_memorystoreInstanceMaintenanceVersionDeploy(context),
1789+
},
1790+
{
1791+
ResourceName: "google_memorystore_instance.instance-ms",
1792+
ImportState: true,
1793+
ImportStateVerify: true,
1794+
},
1795+
{
1796+
Config: testAccMemorystoreInstance_memorystoreInstanceMaintenanceVersionUpdate(context),
1797+
},
1798+
{
1799+
ResourceName: "google_memorystore_instance.instance-ms",
1800+
ImportState: true,
1801+
ImportStateVerify: true,
1802+
},
1803+
},
1804+
})
1805+
}
1806+
1807+
func testAccMemorystoreInstance_memorystoreInstanceMaintenanceVersionDeploy(context map[string]interface{}) string {
1808+
return acctest.Nprintf(`
1809+
resource "google_memorystore_instance" "instance-ms" {
1810+
instance_id = "tf-test-ms-instance%{random_suffix}"
1811+
shard_count = 1
1812+
location = "%{location}"
1813+
node_type = "SHARED_CORE_NANO"
1814+
deletion_protection_enabled = false
1815+
transit_encryption_mode = "SERVER_AUTHENTICATION"
1816+
}
1817+
1818+
`, context)
1819+
}
1820+
1821+
func testAccMemorystoreInstance_memorystoreInstanceMaintenanceVersionUpdate(context map[string]interface{}) string {
1822+
return acctest.Nprintf(`
1823+
resource "google_memorystore_instance" "instance-ms" {
1824+
instance_id = "tf-test-ms-instance%{random_suffix}"
1825+
shard_count = 1
1826+
location = "%{location}"
1827+
node_type = "SHARED_CORE_NANO"
1828+
deletion_protection_enabled = false
1829+
# maintenance_version = "MEMORYSTORE_20241206_00_00"
1830+
transit_encryption_mode = "SERVER_AUTHENTICATION"
1831+
}
1832+
`, context)
1833+
}

mmv1/third_party/terraform/services/redis/resource_redis_cluster_test.go

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1341,3 +1341,80 @@ resource "google_compute_network" "consumer_net" {
13411341
}
13421342
`, context)
13431343
}
1344+
1345+
func TestAccRedisCluster_redisClusterMaintenanceVersion(t *testing.T) {
1346+
t.Parallel()
1347+
1348+
context := map[string]interface{}{
1349+
"random_suffix": acctest.RandString(t, 10),
1350+
"location": "us-central1",
1351+
}
1352+
1353+
acctest.VcrTest(t, resource.TestCase{
1354+
PreCheck: func() { acctest.AccTestPreCheck(t) },
1355+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
1356+
CheckDestroy: testAccCheckRedisClusterDestroyProducer(t),
1357+
Steps: []resource.TestStep{
1358+
{
1359+
Config: testAccRedisCluster_redisClusterMaintenanceVersionDeploy(context),
1360+
},
1361+
{
1362+
ResourceName: "google_redis_cluster.cluster-ms",
1363+
ImportState: true,
1364+
ImportStateVerify: true,
1365+
},
1366+
{
1367+
Config: testAccRedisCluster_redisClusterMaintenanceVersionUpdate(context),
1368+
},
1369+
{
1370+
ResourceName: "google_redis_cluster.cluster-ms",
1371+
ImportState: true,
1372+
ImportStateVerify: true,
1373+
},
1374+
},
1375+
})
1376+
}
1377+
1378+
func testAccRedisCluster_redisClusterMaintenanceVersionDeploy(context map[string]interface{}) string {
1379+
return acctest.Nprintf(`
1380+
resource "google_redis_cluster" "cluster-ms" {
1381+
name = "tf-test-ms-cluster%{random_suffix}"
1382+
shard_count = 1
1383+
region = "%{location}"
1384+
replica_count = 1
1385+
node_type = "REDIS_SHARED_CORE_NANO"
1386+
transit_encryption_mode = "TRANSIT_ENCRYPTION_MODE_SERVER_AUTHENTICATION"
1387+
authorization_mode = "AUTH_MODE_DISABLED"
1388+
redis_configs = {
1389+
maxmemory-policy = "volatile-ttl"
1390+
}
1391+
deletion_protection_enabled = false
1392+
1393+
zone_distribution_config {
1394+
mode = "MULTI_ZONE"
1395+
}
1396+
}
1397+
`, context)
1398+
}
1399+
1400+
func testAccRedisCluster_redisClusterMaintenanceVersionUpdate(context map[string]interface{}) string {
1401+
return acctest.Nprintf(`
1402+
resource "google_redis_cluster" "cluster-ms" {
1403+
name = "tf-test-ms-cluster%{random_suffix}"
1404+
shard_count = 1
1405+
region = "%{location}"
1406+
replica_count = 1
1407+
node_type = "REDIS_SHARED_CORE_NANO"
1408+
transit_encryption_mode = "TRANSIT_ENCRYPTION_MODE_SERVER_AUTHENTICATION"
1409+
authorization_mode = "AUTH_MODE_DISABLED"
1410+
# maintenance_version = "REDISCLUSTER_20251008.00_p00"
1411+
redis_configs = {
1412+
maxmemory-policy = "volatile-ttl"
1413+
}
1414+
deletion_protection_enabled = false
1415+
zone_distribution_config {
1416+
mode = "MULTI_ZONE"
1417+
}
1418+
}
1419+
`, context)
1420+
}

0 commit comments

Comments
 (0)