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

Missing update_mask field in google_memorystore_instance resource #20101

Open
Desolar1um opened this issue Oct 30, 2024 · 5 comments
Open

Missing update_mask field in google_memorystore_instance resource #20101

Desolar1um opened this issue Oct 30, 2024 · 5 comments

Comments

@Desolar1um
Copy link

Desolar1um commented Oct 30, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Terraform Version & Provider Version(s)

Terraform v1.8.5

  • provider registry.terraform.io/hashicorp/google-beta v6.8.0

Affected Resource(s)

google_memorystore_instance

Terraform Configuration

resource "google_memorystore_instance" "valkey-cluster" {
  provider = google-beta
  for_each = local.valkey_clusters

  instance_id = "valkey-${each.key}"
  shard_count = lookup(each.value, "shard_count", 3)
  desired_psc_auto_connections {
    network    = data.google_compute_network.network.id
    project_id = data.google_project.project.project_id
  }
  location                = "europe-west2"
  replica_count           = lookup(each.value, "replica_count", 1)
  node_type               = lookup(each.value, "node_type", "SHARED_CORE_NANO")
  transit_encryption_mode = "TRANSIT_ENCRYPTION_DISABLED"
  authorization_mode      = "AUTH_DISABLED"

  zone_distribution_config {
    mode = "MULTI_ZONE"
  }
  engine_version              = lookup(each.value, "version", "VALKEY_8_0")
  deletion_protection_enabled = false

  labels = {
    redacted
  }
}

data "google_compute_network" "network" {
  name = "network"
}

data "google_project" "project" {
  provider = google
}

Debug Output

│ Error: Error updating Instance "projects/<project>/locations/europe-west2/instances/valkey-cluster": googleapi: Error 400: exactly 1 update_mask field must be specified per update request
│ Details:
│ [
│   {
│     "@type": "type.googleapis.com/google.rpc.BadRequest",
│     "fieldViolations": [
│       {
│         "field": "update_mask"
│       }
│     ]
│   }
│ ]

Expected Behavior

My Valkey cluster should've been decreased from 3 shards 1 replica to 1 shard 0 replicas

Actual Behavior

│ Error: Error updating Instance "projects/<project>/locations/europe-west2/instances/valkey-cluster": googleapi: Error 400: exactly 1 update_mask field must be specified per update request
│ Details:
│ [
│   {
│     "@type": "type.googleapis.com/google.rpc.BadRequest",
│     "fieldViolations": [
│       {
│         "field": "update_mask"
│       }
│     ]
│   }
│ ]

Steps to reproduce

  1. Create valkey cluster using google_memorystore_instance
  2. Attempt to update google_memorystore_instance resource with terraform apply

Important Factoids

No response

References

No response

b/378145653

@Desolar1um Desolar1um added the bug label Oct 30, 2024
@github-actions github-actions bot added forward/review In review; remove label to forward service/redis-instance labels Nov 6, 2024
@ggtisc ggtisc self-assigned this Nov 6, 2024
@ggtisc
Copy link
Collaborator

ggtisc commented Nov 6, 2024

Hi @Desolar1um!

I'm trying to replicate this issue but I'm not getting any errors. Because I do not have access to the variables you are using, this was the code I used:

data "google_compute_network" "cn_20101" {
  name = "cn-20101"
}

data "google_project" "project_20101" {
  provider = google-beta
}

resource "google_compute_subnetwork" "subnetwork_20101" {
  provider      = google-beta
  name          = "subnetwork-20101"
  ip_cidr_range = "10.0.0.248/29"
  region        = "us-central1"
  network       = data.google_compute_network.cn_20101.id
}

resource "google_network_connectivity_service_connection_policy" "service_connection_policy_20101" {
  provider      = google-beta
  name          = "service-connection-policy-20101"
  location      = "us-central1"
  service_class = "gcp-memorystore"
  description   = "something"
  network       = data.google_compute_network.cn_20101.id
  
  psc_config {
    subnetworks = [google_compute_subnetwork.subnetwork_20101.id]
  }
}

resource "google_memorystore_instance" "memorystore_instance_20101" {
  provider = google-beta
  instance_id = "memorystore-instance-20101"
  shard_count = 3

  desired_psc_auto_connections {
    network    = data.google_compute_network.cn_20101.id
    project_id = data.google_project.project_20101.project_id
  }

  location                = "us-central1"
  replica_count           = 1
  node_type               = "SHARED_CORE_NANO"
  transit_encryption_mode = "TRANSIT_ENCRYPTION_DISABLED"
  authorization_mode      = "AUTH_DISABLED"

  zone_distribution_config {
    mode = "MULTI_ZONE"
  }

  engine_version              = "VALKEY_8_0"
  deletion_protection_enabled = false

  labels = {
    "foo" : "bar"
  }
}

Please check it and confirm if it works, I added all necessary resources to use a google_memorystore_instance, like the google_network_connectivity_service_connection_policy. Because if you don't attach it like in the example I'm sharing it is possible that you could get errors when creating the google_memorystore_instance.

If after trying again with these configurations you still have issues please share with us your complete code with the values of the variables and locals you are using to make a new try. You don't need to share sensitive information, for this situations you could use examples like:

@Desolar1um
Copy link
Author

Hi @ggtisc , thanks for taking the time to look at this!

I don't have problems creating instances, this error occurs when I try to update an instance. Please try decreasing the number of shards/replicas on your instance and let me know if it works.

@ggtisc
Copy link
Collaborator

ggtisc commented Nov 8, 2024

Confirmed issue!

When trying to update labels it returns the following error:

Error updating Instance "projects/my-project/locations/us-central1/instances/memorystore-instance-20101": googleapi: Error 400: exactly 1 update_mask field must be specified per update request

And when trying to decrease the shard_count from 3 to 2 or 1 it returns the following error:

Error updating Instance "projects/my-project/locations/us-central1/instances/memorystore-instance-20101": googleapi: Error 400: 2 shard cluster is not yet supported: invalid argument

@ggtisc ggtisc removed the forward/review In review; remove label to forward label Nov 8, 2024
@ggtisc ggtisc removed their assignment Nov 8, 2024
@himanikh
Copy link
Contributor

himanikh commented Nov 9, 2024

Error updating Instance "projects/my-project/locations/us-central1/instances/memorystore-instance-20101": googleapi: Error 400: exactly 1 update_mask field must be specified per update request

Valkey instance update has a restriction that only one field can be updated at a time. The above error indicates that >1 was changed in one go.
Did you try to change any other field along with the labels?

Error updating Instance "projects/my-project/locations/us-central1/instances/memorystore-instance-20101": googleapi: Error 400: 2 shard cluster is not yet supported: invalid argument

Low shard counts have certain limitation today, please follow:
https://cloud.google.com/memorystore/docs/valkey/instance-node-specification#selecting_an_instance_shape_of_1_2_or_4_shards

@Desolar1um
Copy link
Author

I cannot update even 1 field at once. Attempted to reduce only replicas from 1 to 0 and go the same error

Error updating Instance "projects/my-project/locations/us-central1/instances/memorystore-instance-20101": googleapi: Error 400: exactly 1 update_mask field must be specified per update request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants