terraform-provider-google
terraform-provider-google copied to clipboard
Output-only fields are included in Update requests
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
1.5.7 and others.
Affected Resource(s)
google_bigquery_reservation and maybe others.
Terraform Configuration
resource "google_bigquery_reservation" "reservation" {
concurrency = 0
edition = "ENTERPRISE"
ignore_idle_slots = false
location = "EU"
multi_region_auxiliary = false
name = "issue-15826"
project = "daui-storage"
slot_capacity = 0
autoscale {
max_slots = 300
}
}
Debug Output
Observations:
- At the beginning of time,
current_slotsis 0 in TF state file and in the actual reservation. - After auto-scaling kicked in,
current_slotsin the reservation went up to 10. - Running
terraform applywould show no change, then the TF state file was refreshed to include"current_slots": 10. - Modifying the user config to update another filed, e.g.
ignore_idle_slotsfromtruetofalse, then runningterraform applywould show a preview of only theignore_idle_slotsdiff.
Terraform will perform the following actions:
# google_bigquery_reservation.reservation will be updated in-place
~ resource "google_bigquery_reservation" "reservation" {
id = "projects/daui-storage/locations/EU/reservations/issue-15826"
~ ignore_idle_slots = true -> false
name = "issue-15826"
# (6 unchanged attributes hidden)
# (1 unchanged block hidden)
}
Upon confirmation, the command failed with the reported error.
│ Error: Error updating Reservation "projects/daui-storage/locations/EU/reservations/issue-15826": googleapi: Error 400: current_slots from Autoscale must not be set.
In debug logs, current_slots was sent as part of the request.
2023-10-06T00:24:19.784Z [DEBUG] provider.terraform-provider-google_v4.77.0_x5: ---[ REQUEST ]---------------------------------------
2023-10-06T00:24:19.784Z [DEBUG] provider.terraform-provider-google_v4.77.0_x5: PATCH /v1/projects/daui-storage/locations/EU/reservations/issue-15826?alt=json&updateMask=ignoreIdleSlots HTTP/1.1
2023-10-06T00:24:19.784Z [DEBUG] provider.terraform-provider-google_v4.77.0_x5: Host: bigqueryreservation.googleapis.com
2023-10-06T00:24:19.784Z [DEBUG] provider.terraform-provider-google_v4.77.0_x5: User-Agent: Terraform/1.5.6 (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google/4.77.0
2023-10-06T00:24:19.784Z [DEBUG] provider.terraform-provider-google_v4.77.0_x5: Content-Length: 49
2023-10-06T00:24:19.784Z [DEBUG] provider.terraform-provider-google_v4.77.0_x5: Content-Type: application/json
2023-10-06T00:24:19.784Z [DEBUG] provider.terraform-provider-google_v4.77.0_x5: Accept-Encoding: gzip
2023-10-06T00:24:19.784Z [DEBUG] provider.terraform-provider-google_v4.77.0_x5:
2023-10-06T00:24:19.784Z [DEBUG] provider.terraform-provider-google_v4.77.0_x5: {
2023-10-06T00:24:19.784Z [DEBUG] provider.terraform-provider-google_v4.77.0_x5: "autoscale": {
2023-10-06T00:24:19.784Z [DEBUG] provider.terraform-provider-google_v4.77.0_x5: "currentSlots": 10,
2023-10-06T00:24:19.784Z [DEBUG] provider.terraform-provider-google_v4.77.0_x5: "maxSlots": 300
2023-10-06T00:24:19.784Z [DEBUG] provider.terraform-provider-google_v4.77.0_x5: }
2023-10-06T00:24:19.784Z [DEBUG] provider.terraform-provider-google_v4.77.0_x5: }
2023-10-06T00:24:19.784Z [DEBUG] provider.terraform-provider-google_v4.77.0_x5:
2023-10-06T00:24:19.784Z [DEBUG] provider.terraform-provider-google_v4.77.0_x5: -----------------------------------------------------
Expected Behavior
Output-only fields from the config are omitted when constructing requests.
Actual Behavior
Output-only fields from the config are included when constructing requests.
Steps to reproduce
terraform apply
Important Factoids
No response
References
Original customer issue: https://github.com/hashicorp/terraform-provider-google/issues/15826.
Sample generated provider code that includes output-only fields in request: https://github.com/hashicorp/terraform-provider-google/blob/main/google/services/bigqueryreservation/resource_bigquery_reservation.go#L172-L177
https://github.com/GoogleCloudPlatform/magic-modules/pull/9219 was created to address this but closed out of consideration of potentially wide-range impact on other resources.
b/362489353
Hi @wj-chen! Is this duplicated, or you have a different issue?
Apologies @ggtisc, just saw the ping. This was created to track a generalized version of https://github.com/hashicorp/terraform-provider-google/issues/15826. You may forward it to our internal tracking component.