Google Compute Engine Node Group

This page shows how to write Terraform for Compute Engine Node Group and write them securely.


Fix issues in your cloud & app configurations

Test for misconfigurations of this resource in your cloud.


Terraform Example (google_compute_node_group)

Represents a NodeGroup resource to manage a group of sole-tenant nodes. To get more information about NodeGroup, see:

  • API documentation
  • How-to Guides
    • Sole-Tenant Nodes

      Warning: Due to limitations of the API, Terraform cannot update the number of nodes in a node group and changes to node group size either through Terraform config or through external changes will cause Terraform to delete and recreate the node group.


  • creation_timestamp requiredcomputed - string
    • Creation timestamp in RFC3339 text format.

  • description optional - string
    • An optional textual description of the resource.

  • id optionalcomputed - string
  • maintenance_policy optional - string
    • Specifies how to handle instances when a node in the group undergoes maintenance. Set to one of: DEFAULT, RESTART_IN_PLACE, or MIGRATE_WITHIN_NODE_GROUP. The default value is DEFAULT.

  • name optional - string
    • Name of the resource.

  • node_template required - string
    • The URL of the node template to which this node group belongs.

  • project optionalcomputed - string
  • self_link requiredcomputed - string
  • size required - number
    • The total number of nodes in the node group.

  • zone optionalcomputed - string
    • Zone where this node group is located

Example Usage (from GitHub)

resource "google_compute_node_group" "this" {
  description   = var.description
  name          =
  node_template = var.node_template
  project       = var.project
  size          = var.size
resource "google_compute_node_group" "soletenant_grp" {
  name        = "soletenant-group"
  zone        = "us-central1-a"
  description = "Sole-tenant nodes to host Windows VMs"

  size          = 1

Frequently asked questions

What is Google Compute Engine Node Group?

Google Compute Engine Node Group is a resource for Compute Engine of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Compute Engine Node Group?

For Terraform, the niveklabs/google and sylvioneto/terraform_gcp source code examples are useful. See the Terraform Example section for further details.