-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
google_compute_instance can not unset min_cpu_platform #14945
google_compute_instance can not unset min_cpu_platform #14945
Comments
@philip-harvey just curious, can you unset it via console or gcloud? |
Definitely can unset it via Console and GCloud and API, it's documented here: To remove the setting is to simply set it to "AUTOMATIC", but this fails with Terraform currently |
@philip-harvey not sure what happened in your case (to remove the setting is to simply set it to "AUTOMATIC", but this fails with Terraform currently). Using your config, I am able to Removing a minimum CPU platform setting by providing resource "google_compute_instance" "test" {
name = "issue14945"
machine_type = "n1-standard-1" # can be any machine type that you can set min_cpu_platform for, issue is not specific to n1
//min_cpu_platform = "Intel Broadwell" # this can be any min_cpu_platform that is valid for the machine_type you are using
min_cpu_platform = "AUTOMATIC"
zone = "us-central1-a" # can be any zone
allow_stopping_for_update = true
boot_disk {
initialize_params {
image = "debian-cloud/debian-11" # can be any boot disk to reproduce the issue
}
}
network_interface { # can be any network to reproduce the issue
network = "default"
access_config {
// Ephemeral public IP
}
}
} |
Hi @edwardmedia you are changing to a type that supports min_cpu_platform , try setting to a type that doesn't such as e2, it's not possible with Terraform. I wasn't clear about that in my description, sorry. |
@philip-harvey did you say you are able to unset min_cpu_platform for e2 via console or gcloud? It seems that is the rule set by the api. Do you want detail the steps what you can do via console and gcloud? |
Via the console it's trivial, set min_cpu_platform to Automatic and then set the machine type and click save. The issue seems to be that Terraform doesn't unset min_cpu_platform when you delete the value for min_cpu_platform or set to null like you would expect. |
It looks like you are right there are limitations for using |
I can repro this issue. Below is the plan I got. Apply this plan, the provider is supposed to call the api with two steps. Because
|
min_cpu_platform was marked as an optional + computed field, because the API returns a value even if you don't set one. This results in the behavior described: the previous value will keep being sent to the API as long as the API keeps returning it. This is part of how Terraform core treats optional + computed fields. If the default from the API is always But I think that @edwardmedia is correct that we can improve the behavior by switching the update order. I don't think that will change the behavior for empty values but it should at least make it so that |
* Changed order of updates for min_cpu_platform and machine_type Resolved hashicorp/terraform-provider-google#14945 * Added allow_stopping_for_update = true * Added allow_stopping_for_update to ImportStateVerifyIgnore * Added diff suppress and clarified how to 'unset' the field
…corp#8249) * Changed order of updates for min_cpu_platform and machine_type Resolved hashicorp/terraform-provider-google#14945 * Added allow_stopping_for_update = true * Added allow_stopping_for_update to ImportStateVerifyIgnore * Added diff suppress and clarified how to 'unset' the field Signed-off-by: Modular Magician <[email protected]>
#5911) * Changed order of updates for min_cpu_platform and machine_type Resolved hashicorp/terraform-provider-google#14945 * Added allow_stopping_for_update = true * Added allow_stopping_for_update to ImportStateVerifyIgnore * Added diff suppress and clarified how to 'unset' the field Signed-off-by: Modular Magician <[email protected]>
…corp#8249) * Changed order of updates for min_cpu_platform and machine_type Resolved hashicorp#14945 * Added allow_stopping_for_update = true * Added allow_stopping_for_update to ImportStateVerifyIgnore * Added diff suppress and clarified how to 'unset' the field Signed-off-by: Modular Magician <[email protected]>
#15217) * Changed order of updates for min_cpu_platform and machine_type Resolved #14945 * Added allow_stopping_for_update = true * Added allow_stopping_for_update to ImportStateVerifyIgnore * Added diff suppress and clarified how to 'unset' the field Signed-off-by: Modular Magician <[email protected]>
* Changed order of updates for min_cpu_platform and machine_type Resolved hashicorp/terraform-provider-google#14945 * Added allow_stopping_for_update = true * Added allow_stopping_for_update to ImportStateVerifyIgnore * Added diff suppress and clarified how to 'unset' the field Signed-off-by: Modular Magician <[email protected]>
#1173) * Changed order of updates for min_cpu_platform and machine_type Resolved hashicorp/terraform-provider-google#14945 * Added allow_stopping_for_update = true * Added allow_stopping_for_update to ImportStateVerifyIgnore * Added diff suppress and clarified how to 'unset' the field Signed-off-by: Modular Magician <[email protected]>
…eCloudPlatform#8249) * Changed order of updates for min_cpu_platform and machine_type Resolved hashicorp/terraform-provider-google#14945 * Added allow_stopping_for_update = true * Added allow_stopping_for_update to ImportStateVerifyIgnore * Added diff suppress and clarified how to 'unset' the field
…eCloudPlatform#8249) * Changed order of updates for min_cpu_platform and machine_type Resolved hashicorp/terraform-provider-google#14945 * Added allow_stopping_for_update = true * Added allow_stopping_for_update to ImportStateVerifyIgnore * Added diff suppress and clarified how to 'unset' the field
…eCloudPlatform#8249) * Changed order of updates for min_cpu_platform and machine_type Resolved hashicorp/terraform-provider-google#14945 * Added allow_stopping_for_update = true * Added allow_stopping_for_update to ImportStateVerifyIgnore * Added diff suppress and clarified how to 'unset' the field
…eCloudPlatform#8249) * Changed order of updates for min_cpu_platform and machine_type Resolved hashicorp/terraform-provider-google#14945 * Added allow_stopping_for_update = true * Added allow_stopping_for_update to ImportStateVerifyIgnore * Added diff suppress and clarified how to 'unset' the field
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. |
Community Note
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 tohashibot
, a community member has claimed the issue already.Terraform Version
1.44
Google provider 4.69.1
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
Terraform should unset min_cpu_platform when you set it to null or delete it from Terraform.
Actual Behavior
Terraform fails to unset min_cpu_platform when you set it to null or delete it from Terraform. This means you can never change to another instance type using Terraform if you set min_cpu_platform via Terraform.
Error: googleapi: Error 400: Setting minimum CPU platform is not supported for the selected machine type XXXX badRequest
Steps to Reproduce
terraform apply
terraform apply
Important Factoids
I think this is caused by GoogleCloudPlatform/magic-modules#2743
You can never change to another instance type using Terraform if you set min_cpu_platform via Terraform.
References
(https://github.com/GoogleCloudPlatform/magic-modules/pull/2743)](https://github.com/GoogleCloudPlatform/magic-modules/pull/2743)
The text was updated successfully, but these errors were encountered: