Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove immutable annotation from engine_version to support version upgrade. #13149

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions mmv1/products/memorystore/Instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,7 @@ properties:
default_from_api: true
- name: 'engineVersion'
type: String
description: "Optional. Immutable. Engine version of the instance. "
immutable: true
description: "Optional. Engine version of the instance."
default_from_api: true
- name: 'engineConfigs'
type: KeyValuePairs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,49 @@ func TestAccMemorystoreInstance_updateDeletionProtection(t *testing.T) {
})
}

// Validate that engine version is updated for the cluster
func TestAccMemorystoreInstance_updateEngineVersion(t *testing.T) {
t.Parallel()

name := fmt.Sprintf("tf-test-%d", acctest.RandInt(t))

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
CheckDestroy: testAccCheckMemorystoreInstanceDestroyProducer(t),
Steps: []resource.TestStep{
{
// create cluster with engine version 7.2
Config: createOrUpdateMemorystoreInstance(&InstanceParams{
name: name,
shardCount: 3,
zoneDistributionMode: "MULTI_ZONE",
engineVersion: "VALKEY_7_2",
}),
},
{
ResourceName: "google_memorystore_instance.test",
ImportState: true,
ImportStateVerify: true,
},
{
// update cluster with engine version 8.0
Config: createOrUpdateMemorystoreInstance(&InstanceParams{
name: name,
shardCount: 3,
zoneDistributionMode: "MULTI_ZONE",
engineVersion: "VALKEY_8_0",
}),
},
{
ResourceName: "google_memorystore_instance.test",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

// Validate that persistence config is updated for the cluster
func TestAccMemorystoreInstance_updatePersistence(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -234,6 +277,7 @@ type InstanceParams struct {
zone string
deletionProtectionEnabled bool
persistenceMode string
engineVersion string
}

func createOrUpdateMemorystoreInstance(params *InstanceParams) string {
Expand Down Expand Up @@ -278,6 +322,7 @@ resource "google_memorystore_instance" "test" {
project_id = data.google_project.project.project_id
}
deletion_protection_enabled = %t
engine_version = "%s"
engine_configs = {
%s
}
Expand Down Expand Up @@ -314,5 +359,5 @@ resource "google_compute_network" "producer_net" {

data "google_project" "project" {
}
`, params.name, params.replicaCount, params.shardCount, params.nodeType, params.deletionProtectionEnabled, strBuilder.String(), zoneDistributionConfigBlock, persistenceBlock, lifecycleBlock, params.name, params.name, params.name)
`, params.name, params.replicaCount, params.shardCount, params.nodeType, params.deletionProtectionEnabled, params.engineVersion, strBuilder.String(), zoneDistributionConfigBlock, persistenceBlock, lifecycleBlock, params.name, params.name, params.name)
}
Loading