Skip to content

Commit fd2f311

Browse files
Remove immutable annotation from nodeType to support vertical scaling for redis cluster. (#13190) (#21870)
[upstream:7d569ca387a821e42aa581b485a526e36a0ad4b9] Signed-off-by: Modular Magician <[email protected]>
1 parent 16e4061 commit fd2f311

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

.changelog/13190.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
redis: added update support for `google_redis_cluster` `node_type`
3+
```

google/services/redis/resource_redis_cluster.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ resolution and up to nine fractional digits.`,
307307
Type: schema.TypeString,
308308
Computed: true,
309309
Optional: true,
310-
ForceNew: true,
311310
ValidateFunc: verify.ValidateEnum([]string{"REDIS_SHARED_CORE_NANO", "REDIS_HIGHMEM_MEDIUM", "REDIS_HIGHMEM_XLARGE", "REDIS_STANDARD_SMALL", ""}),
312311
Description: `The nodeType for the Redis cluster.
313312
If not provided, REDIS_HIGHMEM_MEDIUM will be used as default Possible values: ["REDIS_SHARED_CORE_NANO", "REDIS_HIGHMEM_MEDIUM", "REDIS_HIGHMEM_XLARGE", "REDIS_STANDARD_SMALL"]`,
@@ -928,6 +927,12 @@ func resourceRedisClusterUpdate(d *schema.ResourceData, meta interface{}) error
928927
billingProject = project
929928

930929
obj := make(map[string]interface{})
930+
nodeTypeProp, err := expandRedisClusterNodeType(d.Get("node_type"), d, config)
931+
if err != nil {
932+
return err
933+
} else if v, ok := d.GetOkExists("node_type"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, nodeTypeProp)) {
934+
obj["nodeType"] = nodeTypeProp
935+
}
931936
pscConfigsProp, err := expandRedisClusterPscConfigs(d.Get("psc_configs"), d, config)
932937
if err != nil {
933938
return err
@@ -992,6 +997,10 @@ func resourceRedisClusterUpdate(d *schema.ResourceData, meta interface{}) error
992997
headers := make(http.Header)
993998
updateMask := []string{}
994999

1000+
if d.HasChange("node_type") {
1001+
updateMask = append(updateMask, "nodeType")
1002+
}
1003+
9951004
if d.HasChange("psc_configs") {
9961005
updateMask = append(updateMask, "pscConfigs")
9971006
}

0 commit comments

Comments
 (0)