Skip to content

googleComputeNodeTemplate

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

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.computeNodeTemplate.ComputeNodeTemplate(this, "template", {
  name: "soletenant-tmpl",
  node_type: "n1-node-96-624",
  region: "us-central1",
});

Example Usage - Node Template Server Binding

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.computeNodeTemplate.ComputeNodeTemplate(this, "template", {
  name: "soletenant-with-licenses",
  node_affinity_labels: [
    {
      foo: "baz",
    },
  ],
  node_type: "n1-node-96-624",
  region: "us-central1",
  server_binding: [
    {
      type: "RESTART_NODE_ON_MINIMAL_SERVERS",
    },
  ],
});
new google.dataGoogleComputeNodeTypes.DataGoogleComputeNodeTypes(
  this,
  "central1a",
  {
    zone: "us-central1-a",
  }
);

Argument Reference

The following arguments are supported:


  • description - (Optional) An optional textual description of the resource.

  • name - (Optional) Name of the resource.

  • nodeAffinityLabels - (Optional) Labels to use for node affinity, which will be used in instance scheduling.

  • nodeType - (Optional) Node type to use for nodes group that are created from this template. Only one of nodeTypeFlexibility and nodeType can be specified.

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

  • serverBinding - (Optional) The server binding policy for nodes using this template. Determines where the nodes should restart following a maintenance event. Structure is documented below.

  • cpuOvercommitType - (Optional) CPU overcommit. Default value is none. Possible values are enabled and 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.

The nodeTypeFlexibility block supports:

  • cpus - (Optional) Number of virtual CPUs to use.

  • memory - (Optional) Physical memory available to the node, defined in MB.

  • localSsd - (Output) Use local SSD

The serverBinding block supports:

  • type - (Required) Type of server binding policy. If restartNodeOnAnyServer, nodes using this template will restart on any physical server following a maintenance event. If restartNodeOnMinimalServer, 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 restartNodeOnAnyServer and restartNodeOnMinimalServers.

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

  • creationTimestamp - Creation timestamp in RFC3339 text format.

  • selfLink - 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:

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