Represents a NodeGroup resource to manage a group of sole-tenant nodes.
To get more information about NodeGroup, see:
resource "google_compute_node_template" "soletenant-tmpl" {
name = "soletenant-tmpl"
region = "us-central1"
node_type = "n1-node-96-624"
}
resource "google_compute_node_group" "nodes" {
name = "soletenant-group"
zone = "us-central1-f"
description = "example google_compute_node_group for Terraform Google Provider"
initial_size = 1
node_template = google_compute_node_template.soletenant-tmpl.id
}
resource "google_compute_node_template" "soletenant-tmpl" {
provider = google-beta
name = "soletenant-tmpl"
region = "us-central1"
node_type = "c2-node-60-240"
}
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"
initial_size = 1
node_template = google_compute_node_template.soletenant-tmpl.id
maintenance_interval = "RECURRENT"
}
resource "google_compute_node_template" "soletenant-tmpl" {
name = "soletenant-tmpl"
region = "us-central1"
node_type = "n1-node-96-624"
}
resource "google_compute_node_group" "nodes" {
name = "soletenant-group"
zone = "us-central1-f"
description = "example google_compute_node_group for Terraform Google Provider"
maintenance_policy = "RESTART_IN_PLACE"
maintenance_window {
start_time = "08:00"
}
initial_size = 1
node_template = google_compute_node_template.soletenant-tmpl.id
autoscaling_policy {
mode = "ONLY_SCALE_OUT"
min_nodes = 1
max_nodes = 10
}
}
resource "google_project" "guest_project" {
project_id = "project-id"
name = "project-name"
org_id = "123456789"
}
resource "google_compute_node_template" "soletenant-tmpl" {
name = "soletenant-tmpl"
region = "us-central1"
node_type = "n1-node-96-624"
}
resource "google_compute_node_group" "nodes" {
name = "soletenant-group"
zone = "us-central1-f"
description = "example google_compute_node_group for Terraform Google Provider"
initial_size = 1
node_template = google_compute_node_template.soletenant-tmpl.id
share_settings {
share_type = "SPECIFIC_PROJECTS"
project_map {
id = google_project.guest_project.project_id
project_id = google_project.guest_project.project_id
}
}
}
The following arguments are supported:
node_template
-
(Required)
The URL of the node template to which this node group belongs.description
-
(Optional)
An optional textual description of the resource.
name
-
(Optional)
Name of the resource.
initial_size
-
(Optional)
The initial number of nodes in the node group. One of initial_size
or autoscaling_policy
must be configured on resource creation.
maintenance_policy
-
(Optional)
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.
maintenance_window
-
(Optional)
contains properties for the timeframe of maintenance
Structure is documented below.
autoscaling_policy
-
(Optional)
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.
One of initial_size
or autoscaling_policy
must be configured on resource creation.
Structure is documented below.
share_settings
-
(Optional)
Share settings for the node group.
Structure is documented below.
maintenance_interval
-
(Optional, Beta)
Specifies the frequency of planned maintenance events. Set to one of the following:
AS_NEEDED
, RECURRENT
.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 maintenance_window
block supports:
start_time
-
(Required)
instances.start time of the window. This must be in UTC format that resolves to one of 00:00, 04:00, 08:00, 12:00, 16:00, or 20:00. For example, both 13:00-5 and 08:00 are valid.The autoscaling_policy
block supports:
mode
-
(Required)
The autoscaling mode. Set to one of the following:
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.
The share_settings
block supports:
share_type
-
(Required)
Node group sharing type.
Possible values are: ORGANIZATION
, SPECIFIC_PROJECTS
, LOCAL
.
project_map
-
(Optional)
A map of project id and project config. This is only valid when shareType's value is SPECIFIC_PROJECTS.
Structure is documented below.
The project_map
block supports:
id
- (Required) The identifier for this object. Format specified above.
project_id
-
(Required)
The project id/number should be the same as the key of this project config in the project map.
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.
size
-
The total number of nodes in the node group.
self_link
- The URI of the created resource.This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.update
- Default is 20 minutes.delete
- Default is 20 minutes.NodeGroup can be imported using any of these accepted formats:
projects/{{project}}/zones/{{zone}}/nodeGroups/{{name}}
{{project}}/{{zone}}/{{name}}
{{zone}}/{{name}}
{{name}}
In Terraform v1.5.0 and later, use an import
block to import NodeGroup using one of the formats above. For example:
import {
id = "projects/{{project}}/zones/{{zone}}/nodeGroups/{{name}}"
to = google_compute_node_group.default
}
When using the terraform import
command, NodeGroup can be imported using one of the formats above. For example:
$ 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}}
This resource supports User Project Overrides.