blob: 5455ca83ee54a5a3a2e8acb7ddbdff3922bd6c72 [file] [log] [blame]
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
subcategory: "Compute Engine"
description: |-
Represents a NodeTemplate resource.
---
# google\_compute\_node\_template
Represents a NodeTemplate resource. Node templates specify properties
for creating sole-tenant nodes, such as node type, vCPU and memory
requirements, node affinity labels, and region.
To get more information about NodeTemplate, see:
* [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/nodeTemplates)
* How-to Guides
* [Sole-Tenant Nodes](https://cloud.google.com/compute/docs/nodes/)
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=node_template_basic&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Node Template Basic
```hcl
resource "google_compute_node_template" "template" {
name = "soletenant-tmpl"
region = "us-central1"
node_type = "n1-node-96-624"
}
```
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=node_template_server_binding&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Node Template Server Binding
```hcl
data "google_compute_node_types" "central1a" {
zone = "us-central1-a"
}
resource "google_compute_node_template" "template" {
name = "soletenant-with-licenses"
region = "us-central1"
node_type = "n1-node-96-624"
node_affinity_labels = {
foo = "baz"
}
server_binding {
type = "RESTART_NODE_ON_MINIMAL_SERVERS"
}
}
```
## Argument Reference
The following arguments are supported:
- - -
* `description` -
(Optional)
An optional textual description of the resource.
* `name` -
(Optional)
Name of the resource.
* `node_affinity_labels` -
(Optional)
Labels to use for node affinity, which will be used in
instance scheduling.
* `node_type` -
(Optional)
Node type to use for nodes group that are created from this template.
Only one of nodeTypeFlexibility and nodeType can be specified.
* `node_type_flexibility` -
(Optional)
Flexible properties for the desired node type. Node groups that
use this node template will create nodes of a type that matches
these properties. Only one of nodeTypeFlexibility and nodeType can
be specified.
Structure is [documented below](#nested_node_type_flexibility).
* `server_binding` -
(Optional)
The server binding policy for nodes using this template. Determines
where the nodes should restart following a maintenance event.
Structure is [documented below](#nested_server_binding).
* `cpu_overcommit_type` -
(Optional)
CPU overcommit.
Default value is `NONE`.
Possible values are: `ENABLED`, `NONE`.
* `region` -
(Optional)
Region where nodes using the node template will be created.
If it is not provided, the provider region is used.
* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
<a name="nested_node_type_flexibility"></a>The `node_type_flexibility` block supports:
* `cpus` -
(Optional)
Number of virtual CPUs to use.
* `memory` -
(Optional)
Physical memory available to the node, defined in MB.
* `local_ssd` -
(Output)
Use local SSD
<a name="nested_server_binding"></a>The `server_binding` block supports:
* `type` -
(Required)
Type of server binding policy. If `RESTART_NODE_ON_ANY_SERVER`,
nodes using this template will restart on any physical server
following a maintenance event.
If `RESTART_NODE_ON_MINIMAL_SERVER`, nodes using this template
will restart on the same physical server following a maintenance
event, instead of being live migrated to or restarted on a new
physical server. This option may be useful if you are using
software licenses tied to the underlying server characteristics
such as physical sockets or cores, to avoid the need for
additional licenses when maintenance occurs. However, VMs on such
nodes will experience outages while maintenance is applied.
Possible values are: `RESTART_NODE_ON_ANY_SERVER`, `RESTART_NODE_ON_MINIMAL_SERVERS`.
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
* `id` - an identifier for the resource with format `projects/{{project}}/regions/{{region}}/nodeTemplates/{{name}}`
* `creation_timestamp` -
Creation timestamp in RFC3339 text format.
* `self_link` - The URI of the created resource.
## Timeouts
This resource provides the following
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
- `create` - Default is 20 minutes.
- `delete` - Default is 20 minutes.
## Import
NodeTemplate can be imported using any of these accepted formats:
* `projects/{{project}}/regions/{{region}}/nodeTemplates/{{name}}`
* `{{project}}/{{region}}/{{name}}`
* `{{region}}/{{name}}`
* `{{name}}`
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import NodeTemplate using one of the formats above. For example:
```tf
import {
id = "projects/{{project}}/regions/{{region}}/nodeTemplates/{{name}}"
to = google_compute_node_template.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), NodeTemplate can be imported using one of the formats above. For example:
```
$ terraform import google_compute_node_template.default projects/{{project}}/regions/{{region}}/nodeTemplates/{{name}}
$ terraform import google_compute_node_template.default {{project}}/{{region}}/{{name}}
$ terraform import google_compute_node_template.default {{region}}/{{name}}
$ terraform import google_compute_node_template.default {{name}}
```
## User Project Overrides
This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).