Skip to content
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_node_types - support new Node Types in node template creation #6617

Closed
mikida12 opened this issue Jun 17, 2020 · 10 comments
Closed
Assignees

Comments

@mikida12
Copy link

mikida12 commented Jun 17, 2020

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

Today, when creating a new node template through GCP UI dashboard, there are 3 types you can choose from, 2 of which were added just recently: c2-node-60-240, m1-node-96-1433, n1-node-96-1433.

In google_compute_node_types there is no option to specify which type will be created, so by default only c2-node-60-240 type can be created. As I can see here
https://www.terraform.io/docs/providers/google/d/google_compute_node_types.html
, only available arguments are: zone, project.

data "google_compute_node_types" "central1b" {
  zone = "us-central1-b"
}

resource "google_compute_node_template" "tmpl" {
  name      = "terraform-test-tmpl"
  region    = "us-central1"
  node_type = data.google_compute_node_types.types.names[0]
}

according to google API https://cloud.google.com/compute/docs/reference/rest/v1/nodeTypes looks like we should send the key "cpuPlatform"

New or Affected Resource(s)

google_compute_node_types
google_compute_node_template

  • google_3.25.0
@ghost ghost added the enhancement label Jun 17, 2020
@vladimirfaile
Copy link

a must have - for me too

@megan07
Copy link
Contributor

megan07 commented Jun 22, 2020

Hi @mikida12 and @vladimirfaile! Thanks for the feature request. I just want to clarify what you're looking for, are you looking for more filter options on the google_compute_node_types data source? Similar to the filter parameter here?

@mikida12
Copy link
Author

@megan07 I think so but I don't see an example that could verify this 100%. When I create a node template from GCP console, there are 3 options (c2-node-60-240, m1-node-96-1433, n1-node-96-1433) but I don't see anywhere I can specify this in TF, so it can only create c2-node-60-240 template by default. I can't create a node template for the other 2 machine types - and this is the functionality I am looking for.

Thanks

@megan07
Copy link
Contributor

megan07 commented Jun 23, 2020

@mikida12 I think there are two examples on how you can do this. One is already possible, the other is what I'm referring to above (we'd have to implement)

Current option (you can hard-code node_type to be whatever you'd like)

resource "google_compute_node_template" "tmpl" {
name = "terraform-test-tmpl"
region = "us-central1"
node_type = "n1-node-96-1433"
}

Second option (we'd need to implement)

data "google_compute_node_types" "central1b" {
zone = "us-central1-b"
cpu_platform = "Intel Skylake"
}
resource "google_compute_node_template" "tmpl" {
name = "terraform-test-tmpl"
region = "us-central1"
node_type = data.google_compute_node_types.types.names[1]
}

I also want to mention, with your current example, you can index any of data.google_compute_node_types.types.names, it doesn't have to just be 0, in which case, you should be able to get to the other types if you'd like. But I'd recommend the first option here if there is a specific node type that you're looking for, just in case the order ever changes.

Let me know if this helps at all or if you still have questions.
Thanks!

@mikida12
Copy link
Author

Thanks for the detailed answer @megan07 .
I tried 2 approaches, but both failed:

  1. specifying node_type = "n1-node-96-1433" is not working:
    Error: Error creating NodeGroup: googleapi: Error 404: The resource 'projects/solebit-dev/zones/us-central1-c/nodeTypes/n1-node-96-1433' was not found, notFound
  2. when I tried to specify node_type = data.google_compute_node_types.node-zone[0].names[2] -> it is not the order which they appear in the drop-down in GCP console. there are currently 7 options and they will probably add more in the future, so we can not relay on this approach

@megan07
Copy link
Contributor

megan07 commented Jun 24, 2020

Hi @mikida12! I took a look - it looks like node-type n1-node-96-1433 is not available in us-central1-c. I'm sure this is documented somewhere, but I did a quick manual lookup in the "Try this API" here specifying the project and zone.
It looks like for us-central1-c you can use n1-node-96-624, n1-node-96-624, or n2-node-80-640.

I wouldn't recommend the second way, just wanted to mention it's an option. To be honest, I'm not sure if the order of the list returned by the API is consistent, but if you wanted to test it you could use the link above and see if the order is the same there rather than checking the order of what's listed in the console.

@megan07 megan07 self-assigned this Jun 24, 2020
@megan07
Copy link
Contributor

megan07 commented Jul 20, 2020

Hi @mikida12! Just wanted to follow up and see if you were able to resolve this issue and if we could close it. Thanks!

@mikida12
Copy link
Author

mikida12 commented Oct 1, 2020

@megan07 sorry for the (very) late reply. I changed node_type to n1-node-96-624 and that worked. Thanks for the help!

@ghost ghost removed waiting-response labels Oct 1, 2020
@megan07
Copy link
Contributor

megan07 commented Oct 5, 2020

@mikida12 - no problem! i'm glad it's working! thanks for letting me know!

@megan07 megan07 closed this as completed Oct 5, 2020
@ghost
Copy link

ghost commented Nov 5, 2020

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 👉 hashibot-feedback@hashicorp.com. Thanks!

@hashicorp hashicorp locked as resolved and limited conversation to collaborators Nov 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants