Skip to content

Latest commit

 

History

History
300 lines (229 loc) · 10.1 KB

compute_node_template.html.markdown

File metadata and controls

300 lines (229 loc) · 10.1 KB
subcategory description
Compute Engine
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:

## Example Usage - Node Template Basic
resource "google_compute_node_template" "template" {
  name      = "soletenant-tmpl"
  region    = "us-central1"
  node_type = "n1-node-96-624"
}
## Example Usage - Node Template Server Binding
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"
  }
}
## Example Usage - Node Template Accelerators
data "google_compute_node_types" "central1a" {
  zone     = "us-central1-a"
}

resource "google_compute_node_template" "template" {
  name      = "soletenant-with-accelerators"
  region    = "us-central1"
  node_type = "n1-node-96-624"

  accelerators {
    accelerator_type  = "nvidia-tesla-t4"
    accelerator_count = 4
  }
}
## Example Usage - Node Template Disks
data "google_compute_node_types" "central1a" {
  zone     = "us-central1-a"
}

resource "google_compute_node_template" "template" {
  name      = "soletenant-with-disks"
  region    = "us-central1"
  node_type = "n2-node-80-640"

  disks {
    disk_count   = 16
    disk_size_gb = 375
    disk_type    = "local-ssd"
  }
}

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.

  • 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.

  • accelerators - (Optional) List of the type and count of accelerator cards attached to the node template Structure is documented below.

  • cpu_overcommit_type - (Optional) CPU overcommit. Default value is NONE. Possible values are: ENABLED, NONE.

  • disks - (Optional) List of the type, size and count of disks attached to the node template Structure is documented below.

  • 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.

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

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.

The accelerators block supports:

  • accelerator_count - (Optional) The number of the guest accelerator cards exposed to this node template.

  • accelerator_type - (Optional) Full or partial URL of the accelerator type resource to expose to this node template.

The disks block supports:

  • disk_count - (Optional) Specifies the number of such disks.

  • disk_type - (Optional) Specifies the desired disk type on the node. This disk type must be a local storage type (e.g.: local-ssd). Note that for nodeTemplates, this should be the name of the disk type and not its URL.

  • disk_size_gb - (Optional) Specifies the size of the disk in base-2 GB.

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 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 to import NodeTemplate using one of the formats above. For example:

import {
  id = "projects/{{project}}/regions/{{region}}/nodeTemplates/{{name}}"
  to = google_compute_node_template.default
}

When using the terraform import command, 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.