NodeGroup class

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

To get more information about NodeGroup, see:

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

Example Usage

Node Group Basic

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const soletenant_tmpl = new gcp.compute.NodeTemplate("soletenant-tmpl", {
    name: "soletenant-tmpl",
    region: "us-central1",
    nodeType: "c2-node-60-240",
});
const nodes = new gcp.compute.NodeGroup("nodes", {
    name: "soletenant-group",
    zone: "us-central1-c",
    description: "example google_compute_node_group for Terraform Google Provider",
    initialSize: 1,
    nodeTemplate: soletenant_tmpl.id,
});
import pulumi
import pulumi_gcp as gcp

soletenant_tmpl = gcp.compute.NodeTemplate("soletenant-tmpl",
    name="soletenant-tmpl",
    region="us-central1",
    node_type="c2-node-60-240")
nodes = gcp.compute.NodeGroup("nodes",
    name="soletenant-group",
    zone="us-central1-c",
    description="example google_compute_node_group for Terraform Google Provider",
    initial_size=1,
    node_template=soletenant_tmpl.id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var soletenant_tmpl = new Gcp.Compute.NodeTemplate("soletenant-tmpl", new()
    {
        Name = "soletenant-tmpl",
        Region = "us-central1",
        NodeType = "c2-node-60-240",
    });

    var nodes = new Gcp.Compute.NodeGroup("nodes", new()
    {
        Name = "soletenant-group",
        Zone = "us-central1-c",
        Description = "example google_compute_node_group for Terraform Google Provider",
        InitialSize = 1,
        NodeTemplate = soletenant_tmpl.Id,
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		soletenant_tmpl, err := compute.NewNodeTemplate(ctx, "soletenant-tmpl", &compute.NodeTemplateArgs{
			Name:     pulumi.String("soletenant-tmpl"),
			Region:   pulumi.String("us-central1"),
			NodeType: pulumi.String("c2-node-60-240"),
		})
		if err != nil {
			return err
		}
		_, err = compute.NewNodeGroup(ctx, "nodes", &compute.NodeGroupArgs{
			Name:         pulumi.String("soletenant-group"),
			Zone:         pulumi.String("us-central1-c"),
			Description:  pulumi.String("example google_compute_node_group for Terraform Google Provider"),
			InitialSize:  pulumi.Int(1),
			NodeTemplate: soletenant_tmpl.ID().ToIDOutput().ToStringOutput(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_compute_nodetemplate" "soletenant-tmpl" {
  name      = "soletenant-tmpl"
  region    = "us-central1"
  node_type = "c2-node-60-240"
}
resource "gcp_compute_nodegroup" "nodes" {
  name          = "soletenant-group"
  zone          = "us-central1-c"
  description   = "example google_compute_node_group for Terraform Google Provider"
  initial_size  = 1
  node_template = gcp_compute_nodetemplate.soletenant-tmpl.id
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.NodeTemplate;
import com.pulumi.gcp.compute.NodeTemplateArgs;
import com.pulumi.gcp.compute.NodeGroup;
import com.pulumi.gcp.compute.NodeGroupArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var soletenant_tmpl = new NodeTemplate("soletenant-tmpl", NodeTemplateArgs.builder()
            .name("soletenant-tmpl")
            .region("us-central1")
            .nodeType("c2-node-60-240")
            .build());

        var nodes = new NodeGroup("nodes", NodeGroupArgs.builder()
            .name("soletenant-group")
            .zone("us-central1-c")
            .description("example google_compute_node_group for Terraform Google Provider")
            .initialSize(1)
            .nodeTemplate(soletenant_tmpl.id())
            .build());

    }
}
resources:
  soletenant-tmpl:
    type: gcp:compute:NodeTemplate
    properties:
      name: soletenant-tmpl
      region: us-central1
      nodeType: c2-node-60-240
  nodes:
    type: gcp:compute:NodeGroup
    properties:
      name: soletenant-group
      zone: us-central1-c
      description: example google_compute_node_group for Terraform Google Provider
      initialSize: 1
      nodeTemplate: ${["soletenant-tmpl"].id}

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

Node Group Maintenance Interval

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const soletenant_tmpl = new gcp.compute.NodeTemplate("soletenant-tmpl", {
    name: "soletenant-tmpl",
    region: "us-central1",
    nodeType: "c2-node-60-240",
});
const nodes = new gcp.compute.NodeGroup("nodes", {
    name: "soletenant-group",
    zone: "us-central1-c",
    description: "example google_compute_node_group for Terraform Google Provider",
    initialSize: 1,
    nodeTemplate: soletenant_tmpl.id,
    maintenanceInterval: "RECURRENT",
});
import pulumi
import pulumi_gcp as gcp

soletenant_tmpl = gcp.compute.NodeTemplate("soletenant-tmpl",
    name="soletenant-tmpl",
    region="us-central1",
    node_type="c2-node-60-240")
nodes = gcp.compute.NodeGroup("nodes",
    name="soletenant-group",
    zone="us-central1-c",
    description="example google_compute_node_group for Terraform Google Provider",
    initial_size=1,
    node_template=soletenant_tmpl.id,
    maintenance_interval="RECURRENT")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var soletenant_tmpl = new Gcp.Compute.NodeTemplate("soletenant-tmpl", new()
    {
        Name = "soletenant-tmpl",
        Region = "us-central1",
        NodeType = "c2-node-60-240",
    });

    var nodes = new Gcp.Compute.NodeGroup("nodes", new()
    {
        Name = "soletenant-group",
        Zone = "us-central1-c",
        Description = "example google_compute_node_group for Terraform Google Provider",
        InitialSize = 1,
        NodeTemplate = soletenant_tmpl.Id,
        MaintenanceInterval = "RECURRENT",
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		soletenant_tmpl, err := compute.NewNodeTemplate(ctx, "soletenant-tmpl", &compute.NodeTemplateArgs{
			Name:     pulumi.String("soletenant-tmpl"),
			Region:   pulumi.String("us-central1"),
			NodeType: pulumi.String("c2-node-60-240"),
		})
		if err != nil {
			return err
		}
		_, err = compute.NewNodeGroup(ctx, "nodes", &compute.NodeGroupArgs{
			Name:                pulumi.String("soletenant-group"),
			Zone:                pulumi.String("us-central1-c"),
			Description:         pulumi.String("example google_compute_node_group for Terraform Google Provider"),
			InitialSize:         pulumi.Int(1),
			NodeTemplate:        soletenant_tmpl.ID().ToIDOutput().ToStringOutput(),
			MaintenanceInterval: pulumi.String("RECURRENT"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_compute_nodetemplate" "soletenant-tmpl" {
  name      = "soletenant-tmpl"
  region    = "us-central1"
  node_type = "c2-node-60-240"
}
resource "gcp_compute_nodegroup" "nodes" {
  name                 = "soletenant-group"
  zone                 = "us-central1-c"
  description          = "example google_compute_node_group for Terraform Google Provider"
  initial_size         = 1
  node_template        = gcp_compute_nodetemplate.soletenant-tmpl.id
  maintenance_interval = "RECURRENT"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.NodeTemplate;
import com.pulumi.gcp.compute.NodeTemplateArgs;
import com.pulumi.gcp.compute.NodeGroup;
import com.pulumi.gcp.compute.NodeGroupArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var soletenant_tmpl = new NodeTemplate("soletenant-tmpl", NodeTemplateArgs.builder()
            .name("soletenant-tmpl")
            .region("us-central1")
            .nodeType("c2-node-60-240")
            .build());

        var nodes = new NodeGroup("nodes", NodeGroupArgs.builder()
            .name("soletenant-group")
            .zone("us-central1-c")
            .description("example google_compute_node_group for Terraform Google Provider")
            .initialSize(1)
            .nodeTemplate(soletenant_tmpl.id())
            .maintenanceInterval("RECURRENT")
            .build());

    }
}
resources:
  soletenant-tmpl:
    type: gcp:compute:NodeTemplate
    properties:
      name: soletenant-tmpl
      region: us-central1
      nodeType: c2-node-60-240
  nodes:
    type: gcp:compute:NodeGroup
    properties:
      name: soletenant-group
      zone: us-central1-c
      description: example google_compute_node_group for Terraform Google Provider
      initialSize: 1
      nodeTemplate: ${["soletenant-tmpl"].id}
      maintenanceInterval: RECURRENT

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

Node Group Autoscaling Policy

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const soletenant_tmpl = new gcp.compute.NodeTemplate("soletenant-tmpl", {
    name: "soletenant-tmpl",
    region: "us-central1",
    nodeType: "c2-node-60-240",
});
const nodes = new gcp.compute.NodeGroup("nodes", {
    name: "soletenant-group",
    zone: "us-central1-a",
    description: "example google_compute_node_group for Google Provider",
    maintenancePolicy: "RESTART_IN_PLACE",
    maintenanceWindow: {
        startTime: "08:00",
    },
    initialSize: 1,
    nodeTemplate: soletenant_tmpl.id,
    autoscalingPolicy: {
        mode: "ONLY_SCALE_OUT",
        minNodes: 1,
        maxNodes: 10,
    },
});
import pulumi
import pulumi_gcp as gcp

soletenant_tmpl = gcp.compute.NodeTemplate("soletenant-tmpl",
    name="soletenant-tmpl",
    region="us-central1",
    node_type="c2-node-60-240")
nodes = gcp.compute.NodeGroup("nodes",
    name="soletenant-group",
    zone="us-central1-a",
    description="example google_compute_node_group for Google Provider",
    maintenance_policy="RESTART_IN_PLACE",
    maintenance_window={
        "start_time": "08:00",
    },
    initial_size=1,
    node_template=soletenant_tmpl.id,
    autoscaling_policy={
        "mode": "ONLY_SCALE_OUT",
        "min_nodes": 1,
        "max_nodes": 10,
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var soletenant_tmpl = new Gcp.Compute.NodeTemplate("soletenant-tmpl", new()
    {
        Name = "soletenant-tmpl",
        Region = "us-central1",
        NodeType = "c2-node-60-240",
    });

    var nodes = new Gcp.Compute.NodeGroup("nodes", new()
    {
        Name = "soletenant-group",
        Zone = "us-central1-a",
        Description = "example google_compute_node_group for Google Provider",
        MaintenancePolicy = "RESTART_IN_PLACE",
        MaintenanceWindow = new Gcp.Compute.Inputs.NodeGroupMaintenanceWindowArgs
        {
            StartTime = "08:00",
        },
        InitialSize = 1,
        NodeTemplate = soletenant_tmpl.Id,
        AutoscalingPolicy = new Gcp.Compute.Inputs.NodeGroupAutoscalingPolicyArgs
        {
            Mode = "ONLY_SCALE_OUT",
            MinNodes = 1,
            MaxNodes = 10,
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		soletenant_tmpl, err := compute.NewNodeTemplate(ctx, "soletenant-tmpl", &compute.NodeTemplateArgs{
			Name:     pulumi.String("soletenant-tmpl"),
			Region:   pulumi.String("us-central1"),
			NodeType: pulumi.String("c2-node-60-240"),
		})
		if err != nil {
			return err
		}
		_, err = compute.NewNodeGroup(ctx, "nodes", &compute.NodeGroupArgs{
			Name:              pulumi.String("soletenant-group"),
			Zone:              pulumi.String("us-central1-a"),
			Description:       pulumi.String("example google_compute_node_group for Google Provider"),
			MaintenancePolicy: pulumi.String("RESTART_IN_PLACE"),
			MaintenanceWindow: &compute.NodeGroupMaintenanceWindowArgs{
				StartTime: pulumi.String("08:00"),
			},
			InitialSize:  pulumi.Int(1),
			NodeTemplate: soletenant_tmpl.ID().ToIDOutput().ToStringOutput(),
			AutoscalingPolicy: &compute.NodeGroupAutoscalingPolicyArgs{
				Mode:     pulumi.String("ONLY_SCALE_OUT"),
				MinNodes: pulumi.Int(1),
				MaxNodes: pulumi.Int(10),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_compute_nodetemplate" "soletenant-tmpl" {
  name      = "soletenant-tmpl"
  region    = "us-central1"
  node_type = "c2-node-60-240"
}
resource "gcp_compute_nodegroup" "nodes" {
  name               = "soletenant-group"
  zone               = "us-central1-a"
  description        = "example google_compute_node_group for Google Provider"
  maintenance_policy = "RESTART_IN_PLACE"
  maintenance_window = {
    start_time = "08:00"
  }
  initial_size  = 1
  node_template = gcp_compute_nodetemplate.soletenant-tmpl.id
  autoscaling_policy = {
    mode      = "ONLY_SCALE_OUT"
    min_nodes = 1
    max_nodes = 10
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.NodeTemplate;
import com.pulumi.gcp.compute.NodeTemplateArgs;
import com.pulumi.gcp.compute.NodeGroup;
import com.pulumi.gcp.compute.NodeGroupArgs;
import com.pulumi.gcp.compute.inputs.NodeGroupMaintenanceWindowArgs;
import com.pulumi.gcp.compute.inputs.NodeGroupAutoscalingPolicyArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var soletenant_tmpl = new NodeTemplate("soletenant-tmpl", NodeTemplateArgs.builder()
            .name("soletenant-tmpl")
            .region("us-central1")
            .nodeType("c2-node-60-240")
            .build());

        var nodes = new NodeGroup("nodes", NodeGroupArgs.builder()
            .name("soletenant-group")
            .zone("us-central1-a")
            .description("example google_compute_node_group for Google Provider")
            .maintenancePolicy("RESTART_IN_PLACE")
            .maintenanceWindow(NodeGroupMaintenanceWindowArgs.builder()
                .startTime("08:00")
                .build())
            .initialSize(1)
            .nodeTemplate(soletenant_tmpl.id())
            .autoscalingPolicy(NodeGroupAutoscalingPolicyArgs.builder()
                .mode("ONLY_SCALE_OUT")
                .minNodes(1)
                .maxNodes(10)
                .build())
            .build());

    }
}
resources:
  soletenant-tmpl:
    type: gcp:compute:NodeTemplate
    properties:
      name: soletenant-tmpl
      region: us-central1
      nodeType: c2-node-60-240
  nodes:
    type: gcp:compute:NodeGroup
    properties:
      name: soletenant-group
      zone: us-central1-a
      description: example google_compute_node_group for Google Provider
      maintenancePolicy: RESTART_IN_PLACE
      maintenanceWindow:
        startTime: 08:00
      initialSize: 1
      nodeTemplate: ${["soletenant-tmpl"].id}
      autoscalingPolicy:
        mode: ONLY_SCALE_OUT
        minNodes: 1
        maxNodes: 10

Node Group Share Settings

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const guestProject = new gcp.organizations.Project("guest_project", {
    projectId: "project-id",
    name: "project-name",
    orgId: "123456789",
    deletionPolicy: "DELETE",
});
const soletenant_tmpl = new gcp.compute.NodeTemplate("soletenant-tmpl", {
    name: "soletenant-tmpl",
    region: "us-central1",
    nodeType: "c2-node-60-240",
});
const nodes = new gcp.compute.NodeGroup("nodes", {
    name: "soletenant-group",
    zone: "us-central1-a",
    description: "example google_compute_node_group for Google Provider",
    initialSize: 1,
    nodeTemplate: soletenant_tmpl.id,
    shareSettings: {
        shareType: "SPECIFIC_PROJECTS",
        projectMaps: [{
            id: guestProject.projectId,
            projectId: guestProject.projectId,
        }],
    },
});
import pulumi
import pulumi_gcp as gcp

guest_project = gcp.organizations.Project("guest_project",
    project_id="project-id",
    name="project-name",
    org_id="123456789",
    deletion_policy="DELETE")
soletenant_tmpl = gcp.compute.NodeTemplate("soletenant-tmpl",
    name="soletenant-tmpl",
    region="us-central1",
    node_type="c2-node-60-240")
nodes = gcp.compute.NodeGroup("nodes",
    name="soletenant-group",
    zone="us-central1-a",
    description="example google_compute_node_group for Google Provider",
    initial_size=1,
    node_template=soletenant_tmpl.id,
    share_settings={
        "share_type": "SPECIFIC_PROJECTS",
        "project_maps": [{
            "id": guest_project.project_id,
            "project_id": guest_project.project_id,
        }],
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var guestProject = new Gcp.Organizations.Project("guest_project", new()
    {
        ProjectId = "project-id",
        Name = "project-name",
        OrgId = "123456789",
        DeletionPolicy = "DELETE",
    });

    var soletenant_tmpl = new Gcp.Compute.NodeTemplate("soletenant-tmpl", new()
    {
        Name = "soletenant-tmpl",
        Region = "us-central1",
        NodeType = "c2-node-60-240",
    });

    var nodes = new Gcp.Compute.NodeGroup("nodes", new()
    {
        Name = "soletenant-group",
        Zone = "us-central1-a",
        Description = "example google_compute_node_group for Google Provider",
        InitialSize = 1,
        NodeTemplate = soletenant_tmpl.Id,
        ShareSettings = new Gcp.Compute.Inputs.NodeGroupShareSettingsArgs
        {
            ShareType = "SPECIFIC_PROJECTS",
            ProjectMaps = new[]
            {
                new Gcp.Compute.Inputs.NodeGroupShareSettingsProjectMapArgs
                {
                    Id = guestProject.ProjectId,
                    ProjectId = guestProject.ProjectId,
                },
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		guestProject, err := organizations.NewProject(ctx, "guest_project", &organizations.ProjectArgs{
			ProjectId:      pulumi.String("project-id"),
			Name:           pulumi.String("project-name"),
			OrgId:          pulumi.String("123456789"),
			DeletionPolicy: pulumi.String("DELETE"),
		})
		if err != nil {
			return err
		}
		soletenant_tmpl, err := compute.NewNodeTemplate(ctx, "soletenant-tmpl", &compute.NodeTemplateArgs{
			Name:     pulumi.String("soletenant-tmpl"),
			Region:   pulumi.String("us-central1"),
			NodeType: pulumi.String("c2-node-60-240"),
		})
		if err != nil {
			return err
		}
		_, err = compute.NewNodeGroup(ctx, "nodes", &compute.NodeGroupArgs{
			Name:         pulumi.String("soletenant-group"),
			Zone:         pulumi.String("us-central1-a"),
			Description:  pulumi.String("example google_compute_node_group for Google Provider"),
			InitialSize:  pulumi.Int(1),
			NodeTemplate: soletenant_tmpl.ID().ToIDOutput().ToStringOutput(),
			ShareSettings: &compute.NodeGroupShareSettingsArgs{
				ShareType: pulumi.String("SPECIFIC_PROJECTS"),
				ProjectMaps: compute.NodeGroupShareSettingsProjectMapArray{
					&compute.NodeGroupShareSettingsProjectMapArgs{
						Id:        guestProject.ProjectId,
						ProjectId: guestProject.ProjectId,
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_organizations_project" "guest_project" {
  project_id      = "project-id"
  name            = "project-name"
  org_id          = "123456789"
  deletion_policy = "DELETE"
}
resource "gcp_compute_nodetemplate" "soletenant-tmpl" {
  name      = "soletenant-tmpl"
  region    = "us-central1"
  node_type = "c2-node-60-240"
}
resource "gcp_compute_nodegroup" "nodes" {
  name          = "soletenant-group"
  zone          = "us-central1-a"
  description   = "example google_compute_node_group for Google Provider"
  initial_size  = 1
  node_template = gcp_compute_nodetemplate.soletenant-tmpl.id
  share_settings = {
    share_type = "SPECIFIC_PROJECTS"
    project_maps = [{
      "id"        = gcp_organizations_project.guest_project.project_id
      "projectId" = gcp_organizations_project.guest_project.project_id
    }]
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.Project;
import com.pulumi.gcp.organizations.ProjectArgs;
import com.pulumi.gcp.compute.NodeTemplate;
import com.pulumi.gcp.compute.NodeTemplateArgs;
import com.pulumi.gcp.compute.NodeGroup;
import com.pulumi.gcp.compute.NodeGroupArgs;
import com.pulumi.gcp.compute.inputs.NodeGroupShareSettingsArgs;
import com.pulumi.gcp.compute.inputs.NodeGroupShareSettingsProjectMapArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var guestProject = new Project("guestProject", ProjectArgs.builder()
            .projectId("project-id")
            .name("project-name")
            .orgId("123456789")
            .deletionPolicy("DELETE")
            .build());

        var soletenant_tmpl = new NodeTemplate("soletenant-tmpl", NodeTemplateArgs.builder()
            .name("soletenant-tmpl")
            .region("us-central1")
            .nodeType("c2-node-60-240")
            .build());

        var nodes = new NodeGroup("nodes", NodeGroupArgs.builder()
            .name("soletenant-group")
            .zone("us-central1-a")
            .description("example google_compute_node_group for Google Provider")
            .initialSize(1)
            .nodeTemplate(soletenant_tmpl.id())
            .shareSettings(NodeGroupShareSettingsArgs.builder()
                .shareType("SPECIFIC_PROJECTS")
                .projectMaps(NodeGroupShareSettingsProjectMapArgs.builder()
                    .id(guestProject.projectId())
                    .projectId(guestProject.projectId())
                    .build())
                .build())
            .build());

    }
}
resources:
  guestProject:
    type: gcp:organizations:Project
    name: guest_project
    properties:
      projectId: project-id
      name: project-name
      orgId: '123456789'
      deletionPolicy: DELETE
  soletenant-tmpl:
    type: gcp:compute:NodeTemplate
    properties:
      name: soletenant-tmpl
      region: us-central1
      nodeType: c2-node-60-240
  nodes:
    type: gcp:compute:NodeGroup
    properties:
      name: soletenant-group
      zone: us-central1-a
      description: example google_compute_node_group for Google Provider
      initialSize: 1
      nodeTemplate: ${["soletenant-tmpl"].id}
      shareSettings:
        shareType: SPECIFIC_PROJECTS
        projectMaps:
          - id: ${guestProject.projectId}
            projectId: ${guestProject.projectId}

Import

NodeGroup can be imported using any of these accepted formats:

  • projects/{{project}}/zones/{{zone}}/nodeGroups/{{name}}
  • {{project}}/{{zone}}/{{name}}
  • {{zone}}/{{name}}
  • {{name}}

When using the pulumi import command, NodeGroup can be imported using one of the formats above. For example:

$ pulumi import gcp:compute/nodeGroup:NodeGroup default projects/{{project}}/zones/{{zone}}/nodeGroups/{{name}}
$ pulumi import gcp:compute/nodeGroup:NodeGroup default {{project}}/{{zone}}/{{name}}
$ pulumi import gcp:compute/nodeGroup:NodeGroup default {{zone}}/{{name}}
$ pulumi import gcp:compute/nodeGroup:NodeGroup default {{name}}

Constructors

NodeGroup(String name, {NodeGroupArgs? args, CustomResourceOptions? options})
Creates a new NodeGroup. name The Pulumi resource name. args Arguments used to configure this NodeGroup. The set of arguments for NodeGroup. options Resource options controlling this resource's behavior.
NodeGroup.reference(String urn)
Creates a typed reference to an existing NodeGroup resource.

Properties

autoscalingPolicy ↔ Output<NodeGroupAutoscalingPolicy>
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 initialSize or autoscalingPolicy must be configured on resource creation. Structure is documented below.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
creationTimestamp ↔ Output<String>
Creation timestamp in RFC3339 text format.
latefinal
deletionPolicy ↔ Output<String>
Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
latefinal
description ↔ Output<String?>
An optional textual description of the resource.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
initialSize ↔ Output<int?>
The initial number of nodes in the node group. One of initialSize or autoscalingPolicy must be configured on resource creation.
latefinal
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
maintenanceInterval ↔ Output<String>
(Optional, Beta) Specifies the frequency of planned maintenance events. Set to one of the following:
latefinal
maintenancePolicy ↔ Output<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.
latefinal
maintenanceWindow ↔ Output<NodeGroupMaintenanceWindow?>
contains properties for the timeframe of maintenance Structure is documented below.
latefinal
name ↔ Output<String>
Name of the resource.
latefinal
nodeTemplate ↔ Output<String>
The URL of the node template to which this node group belongs.
latefinal
project ↔ Output<String>
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
The URI of the created resource.
latefinal
shareSettings ↔ Output<NodeGroupShareSettings>
Share settings for the node group. Structure is documented below.
latefinal
size ↔ Output<int>
The total number of nodes in the node group.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited
zone ↔ Output<String>
Zone where this node group is located
latefinal

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {NodeGroupState? state, CustomResourceOptions? options}) → NodeGroup
Gets an existing NodeGroup resource's state with the given name and id.