Terraform-provider-google: Add support to selecting N1 or N2 machine type when using custom machine types.

Created on 10 Oct 2019  ·  11Comments  ·  Source: hashicorp/terraform-provider-google


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 the 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 the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

Google introduced new machine types - N2 for predefined and custom machine types.
When creating a a compute instance or node pool for a K8S cluster which is using a custom machine type I want to be able to specify which machine type I would like.

New or Affected Resource(s)

  • google_container_node_pool
  • google_compute_instance

Potential Terraform Configuration

node_config {
    machine_type = "n2-custom-8-10240"
    .....

References

https://cloud.google.com/compute/docs/instances/creating-instance-with-custom-machine-type#n2_custom_machine_types

bug

All 11 comments

So just specify it, what's the problem?

Hi,
I believe his problem is simply that it doesn't work.

When specifying n2-custom-cpu-ram, you end up with something like this:

Error: Error waiting for creating GKE NodePool: Google Compute Engine: The resource 'projects/at-delivery-platform-testing/zones/europe-west4-a/machineTypes/n2-custom-8-10240' was not found.

It appears as if terraform is looking for the machine type as it hasn't recognised that it is indeed, custom.

Previously to create custom pools we wouldn't add the n1- or n2- prefix, however, specifying it as custom-8-10240, with a min_cpu_platform of Cascade Lake (which is N2) does not work either (the pool creates, but on the google side it does not provision, if you create an N2 pool through the gui the type is indeed n2-custom-8-10240 hence why we are both trying n2-).

I would hold off making any changes to terraform to support this just yet, we have an open case with google about the partial support for n2 on gke and have fed back these api differences

They’ve just replied saying the implementation is still under development and the eta for it to be “working” is the 11th November

So to be super clear about the problem as i'm not really getting anywhere with GCP support:

to provision n1 (as it is currently), on Intel SkyLake, you would do:

machine-type: custom-10-10240
min-cpu-platform: Intel SkyLake

Therefore logically to get CascadeLake, you'd expect:

machine-type: custom-10-10240
min-cpu-platform: Intel CascadeLake

However this doesn't work, the pool provisions but the nodes never start with an error about custom-10-10240 not being valid for Intel Cascade Lake.

If you create a pool in the GUI (which works), the machine type is actually prefixed with n2-, so if you do this:

machine-type: n2-custom-10-10240
min-cpu-platform: Intel CascadeLake

Terraform fails with the following error:

Error: Error waiting for creating GKE NodePool: 
  Google Compute Engine: 
    The resource 'projects/at-delivery-platform-testing/zones/europe-west4-a/machineTypes/n2-custom-8-10240' was not found.

Hey @danawillow sorry to be tagging you directly but you've helped me out a lot historically :-)

Not really sure where to turn here, not much engagement here and GCP support when I highlight the API convention changes to them :-(

As it stands, you can't use N2 (Cascade Lake) instances on GKE with Terraform because of this.

Hey @Stono, I'm not sure this is something we need to explicitly add (it should just work out of the box), but we can probably document how to do it. Does it work with gcloud, and if so, can you run the command with --log-http to see what the POST request getting sent to GKE looks like?

Hey @Stono, I'm not sure this is something we need to explicitly add (it should just work out of the box), but we can probably document how to do it. Does it work with gcloud, and if so, can you run the command with --log-http to see what the POST request getting sent to GKE looks like?

Hi, I'm experiencing this exact same error.
I've attached a http log of the gcloud command: gcloud compute instances create sj-n2-test --custom-vm-type=n2 --custom-cpu=4 --custom-memory=7168MB --zone=europe-west1-b --log-http
n2-instance-http-log.txt

The generated custom machine type is "n2-custom-4-7168". When this string is used in Terraform as a machine_type, it looks like TF instead tries to use a standard machine type with that name.

I am closing this issue as now i am able to create instances with custom type n2-custom-8-10240. Please reopen if you still face the issue.

Given that @Qvazar's comment is from earlier today, I think that means they're still facing the issue :)

@Qvazar, do you have debug logs (https://www.terraform.io/docs/internals/debugging.html) from a run of Terraform that failed with that machine type?

Given that @Qvazar's comment is from earlier today, I think that means they're still facing the issue :)

@Qvazar, do you have debug logs (https://www.terraform.io/docs/internals/debugging.html) from a run of Terraform that failed with that machine type?

Hi @danawillow,
Since @venkykuberan is able to create custom instances with type n2, I assume this is fixed in the newest TF release?
I'm still stuck on 0.11 for now, but upgrading is planned for the near future.

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!

Was this page helpful?
0 / 5 - 0 ratings