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 v0.12.24
google_compute_instance
# before machine_type change
resource "google_compute_instance" "instance" {
name = "test-instance"
zone = "europe-west1-b"
allow_stopping_for_update = true
machine_type = "n2-standard-2"
network_interface {
subnetwork = "test"
subnetwork_project = "bla-network"
}
boot_disk {
initialize_params {
image = "centos-cloud/centos-7"
}
}
}
# after machine_type change
resource "google_compute_instance" "instance" {
name = "test-instance"
zone = "europe-west1-b"
allow_stopping_for_update = true
machine_type = "e2-standard-2"
network_interface {
subnetwork = "test"
subnetwork_project = "bla-network"
}
boot_disk {
initialize_params {
image = "centos-cloud/centos-7"
}
}
}
https://gist.github.com/ilicmilan/5af1bbedcfa45cf60c90a4dd2ccb776b
Error: googleapi: Error 400: Setting minimum CPU platform is not supported for the selected machine type e2-standard-2., badRequest
on main.tf line 2, in resource "google_compute_instance" "instance":
2: resource "google_compute_instance" "instance" {
Machine type is changed from n2-standard-2 to e2-standard-2 and as a consequence machine was stopped and started again.
The machine was stopped, the new machine type setup failed due to min_cpu_platform and the machine remained stopped.
terraform apply to create N2 instanceterraform apply to change the machine typeIf I decide to do N2 -> N1 transition, the error is:
Error 400: The selected machine type (n1-standard-2) is not compatible with CPU platform cascadelake, badRequest
Provider can't validate the compatibility between machine types and cpu platforms. It relies on API and pass the response to the client.
@c2thorn your thoughts ?
The API is defaulting to min_cpu_platform = "Intel Cascade Lake" in this scenario. You can work around this by setting your min_cpu_platform = "Automatic" before transitioning the machine_type.
Unfortunately it looks like this cannot be done on the same terraform apply, as the provider currently attempts to modify the machine_type before modifying the min_cpu_platform. I'll have to check to see if this can be re-ordered without affecting any current use cases.
However the immediate work around would be to:
min_cpu_platform = "Automatic"machine_typeWhy have you closed this? Is it now fixed?
Sorry, I should have posted an explanation. I believe this interaction has changed upstream in the API (I can't find any relevant changes in the provider, but I could be wrong), as transitioning the machine type also changes cpu_platform to an acceptable value. When I retried the steps described in the original post, it was successful.
@kustodian do you still see this issue occuring? If so it would be helpful to see your debug output.
I just tested it with Terraform v0.13.0 and google provider v3.25.0 and it was successful, indeed.
Awesome! Then it was a good call for closing it :D
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 👉 [email protected]. Thanks!