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

Error 400 when updating a google_spanner_instance's config #7732

Assignees
Labels

Comments

@quentinms
Copy link

quentinms commented Nov 6, 2020

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 the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Terraform v0.12.18
+ provider.google v3.46.0
+ provider.google-beta v3.46.0

Affected Resource(s)

  • google_spanner_instance

Terraform Configuration Files

Current config:

resource "google_spanner_instance" "test" {
  project      = "project"
  name         = "qms-test"
  config       = "regional-us-east1"
  display_name = "QMS Test"
  num_nodes    = 1
}

New config I want to apply (update config):

resource "google_spanner_instance" "test" {
  project      = "project"
  name         = "qms-test"
  config       = "nam11"
  display_name = "QMS Test"
  num_nodes    = 1
}

Debug Output

https://gist.github.com/quentinms/fb986ab0dbc83faf5c8b5edc8d50dace

Panic Output

N/A

Expected Behavior

Terraform should have updated spanner's config in-place.
(Or maybe it should recreate the instance, it's not clear to me if changing the config is allowed, it's not exposed in the UI)

Actual Behavior

Apply Error

Error: Error updating Instance "xxx/qms-test": googleapi: Error 400: Invalid UpdateInstance request.
Details:
[
  {
    "@type": "type.googleapis.com/google.rpc.BadRequest",
    "fieldViolations": [
      {
        "description": "Must specify a non-empty field mask.",
        "field": "field_mask"
      }
    ]
  }
]

Steps to Reproduce

  1. Create a spanner instance
resource "google_spanner_instance" "test" {
  project      = "project"
  name         = "test"
  config       = "regional-us-east1"
  display_name = "test"
  num_nodes    = 1
}
  1. Plan & Apply

  2. Update the instance's config

resource "google_spanner_instance" "test" {
  project      = "project"
  name         = "test"
  config       = "nam11"
  display_name = "test"
  num_nodes    = 1
}
  1. Plan
Terraform will perform the following actions:

  # google_spanner_instance.muybridge will be updated in-place
  ~ resource "google_spanner_instance" "test" {
      ~ config       = "projects/project/instanceConfigs/regional-us-east1" -> "nam11"
        display_name = "Muybridge"
        id           = "project/test"
        labels       = {}
        name         = "test"
        num_nodes    = 1
        project      = "project"
        state        = "READY"
    }
  1. Apply
Error: Error updating Instance "project/test": googleapi: Error 400: Invalid UpdateInstance request.
Details:
[
  {
    "@type": "type.googleapis.com/google.rpc.BadRequest",
    "fieldViolations": [
      {
        "description": "Must specify a non-empty field mask.",
        "field": "field_mask"
      }
    ]
  }
]

Important Factoids

N/A

References

@ghost ghost added the bug label Nov 6, 2020
@edwardmedia edwardmedia self-assigned this Nov 6, 2020
@edwardmedia
Copy link
Contributor

@quentinms can you share the debug log?

@quentinms
Copy link
Author

@edwardmedia Added a gist to the issue description.

@ghost ghost removed the waiting-response label Nov 6, 2020
@edwardmedia edwardmedia assigned c2thorn and slevenick and unassigned c2thorn Nov 6, 2020
@slevenick
Copy link
Collaborator

I can reproduce this, and the issue is that config is not added to the fieldMask under any circumstances. I think that is intentional though, as when I add it to the fieldMask I get the following error: Error 501: Changing the configuration of an existing instance is not supported.

Other than the interesting choice of error code #, I think updating config is not supported and what we actually want to happen is that the instance is recreated. Does that sound like what you want to do, or is there a reason you think you can update the config in-place?

@quentinms
Copy link
Author

Recreating the instance sounds good. I was actually surprised when I first planned that it would update in-place.

@ghost
Copy link

ghost commented Dec 10, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.