-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Closed
Copy link
Labels
Description
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-magicianuser, 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 tohashibot, a community member has claimed the issue already.
Terraform Version
1.3.8
Affected Resource(s)
Not sure which one, or both of :
- google_spanner_instance
- google_spanner_database
Terraform Configuration Files
provider "google" {
project = var.project
region = var.region
}
terraform {
required_version = "1.3.8"
required_providers {
google = {
source = "hashicorp/google"
version = "4.53"
}
}
}
resource "google_spanner_instance" "supply_chain" {
name = "test-db"
display_name = "Test DB"
config = "regional-${var.region}"
processing_units = 100
force_destroy = var.enable_force_destroy
}
resource "google_spanner_database" "supply_chain" {
instance = google_spanner_instance.supply_chain.name
name = "test"
deletion_protection = !var.enable_force_destroy
}
variable "project" {
type = string
}
variable "region" {
type = string
}
variable "enable_force_destroy"{
type = bool
default = true
}Debug Output
Panic Output
Expected Behavior
Both database and spanner instances shoud have been updated by changing their force_destroy and deletion_protection
Actual Behavior
Only the database is updated correctly, the instance doesn't update with the error :
| Error: Error updating Instance "prj-resim/test-db": 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"
│ }
│ ]
│ }
│ ]
│
│ with google_spanner_instance.supply_chain,
│ on main.tf line 16, in resource "google_spanner_instance" "supply_chain":
│ 16: resource "google_spanner_instance" "supply_chain"
However, a second apply with the same values succeeds
Steps to Reproduce
With no deployment :
terraform initterraform apply -var=project=PROJECT -var=region=REGION -var=enable_force_destroy=true -auto-approveterraform apply -var=project=PROJECT -var=region=REGION -var=enable_force_destroy=false -auto-approve
The deployment should have failedterraform apply -var=project=PROJECT -var=region=REGION -var=enable_force_destroy=false -auto-approve
The deployment should have succeededterraform apply -var=project=PROJECT -var=region=REGION -var=enable_force_destroy=true -auto-approve
The deployment should have failedterraform apply -var=project=PROJECT -var=region=REGION -var=enable_force_destroy=true -auto-approve
The deployment should have succeeded
Important Factoids
References
Same error but different reason :
dgouju