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:

Open in Cloud Shell

Example Usage - Node Template Basic

resource "google_compute_node_template" "template" {
  name      = "soletenant-tmpl"
  region    = "us-central1"
  node_type = "n1-node-96-624"
}
Open in Cloud Shell

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"
  }
}

Argument Reference

The following arguments are supported:


The node_type_flexibility block supports:

The server_binding block supports:

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

Timeouts

This resource provides the following Timeouts configuration options:

Import

NodeTemplate can be imported using any of these accepted formats:

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.