» google_compute_node_group

Represents a NodeGroup resource to manage a group of sole-tenant nodes.

To get more information about NodeGroup, see:

» Example Usage - Node Group Basic

data "google_compute_node_types" "central1a" {
  zone = "us-central1-a"
}

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

resource "google_compute_node_group" "nodes" {
  name        = "soletenant-group"
  zone        = "us-central1-a"
  description = "example google_compute_node_group for Terraform Google Provider"

  size          = 1
  node_template = google_compute_node_template.soletenant-tmpl.id
}

» Example Usage - Node Group Autoscaling Policy

data "google_compute_node_types" "central1a" {
  provider = google-beta
  zone = "us-central1-a"
}

resource "google_compute_node_template" "soletenant-tmpl" {
  provider = google-beta
  name      = "soletenant-tmpl"
  region    = "us-central1"
  node_type = data.google_compute_node_types.central1a.names[0]
}

resource "google_compute_node_group" "nodes" {
  provider = google-beta
  name        = "soletenant-group"
  zone        = "us-central1-a"
  description = "example google_compute_node_group for Terraform Google Provider"

  size          = 1
  node_template = google_compute_node_template.soletenant-tmpl.id
  autoscaling_policy {
    mode = "ON"
    min_nodes = 1
    max_nodes = 10
  }
}

» Argument Reference

The following arguments are supported:

  • node_template - (Required) The URL of the node template to which this node group belongs.

  • size - (Required) The total number of nodes in the node group.


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

  • name - (Optional) Name of the resource.

  • autoscaling_policy - (Optional, Beta) If you use sole-tenant nodes for your workloads, you can use the node group autoscaler to automatically manage the sizes of your node groups. Structure is documented below.

  • zone - (Optional) Zone where this node group is located

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

The autoscaling_policy block supports:

  • mode - (Required) The autoscaling mode. Set to one of the following:
    • OFF: Disables the autoscaler.
    • ON: Enables scaling in and scaling out.
    • ONLY_SCALE_OUT: Enables only scaling out. You must use this mode if your node groups are configured to restart their hosted VMs on minimal servers.

Possible values are: * OFF * ON * ONLY_SCALE_OUT

  • min_nodes - (Optional) Minimum size of the node group. Must be less than or equal to max-nodes. The default value is 0.

  • max_nodes - (Required) Maximum size of the node group. Set to a value less than or equal to 100 and greater than or equal to min-nodes.

» 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}}/zones/{{zone}}/nodeGroups/{{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 4 minutes.
  • update - Default is 4 minutes.
  • delete - Default is 4 minutes.

» Import

NodeGroup can be imported using any of these accepted formats:

$ terraform import google_compute_node_group.default projects/{{project}}/zones/{{zone}}/nodeGroups/{{name}}
$ terraform import google_compute_node_group.default {{project}}/{{zone}}/{{name}}
$ terraform import google_compute_node_group.default {{zone}}/{{name}}
$ terraform import google_compute_node_group.default {{name}}

» User Project Overrides

This resource supports User Project Overrides.