1. Packages
  2. Packages
  3. Google Cloud (GCP) Classic
  4. API Docs
  5. compute
  6. getInstanceGroups
Viewing docs for Google Cloud v9.32.1
published on Wednesday, Jul 29, 2026 by Pulumi
gcp logo
Viewing docs for Google Cloud v9.32.1
published on Wednesday, Jul 29, 2026 by Pulumi

    Get a list of Instance Groups within GCE. For more information, see the official documentation and API.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const all = gcp.compute.getInstanceGroups({
        zone: "us-central1-a",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    all = gcp.compute.get_instance_groups(zone="us-central1-a")
    
    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 {
    		_, err := compute.GetInstanceGroups(ctx, &compute.GetInstanceGroupsArgs{
    			Zone: pulumi.StringRef("us-central1-a"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var all = Gcp.Compute.GetInstanceGroups.Invoke(new()
        {
            Zone = "us-central1-a",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.ComputeFunctions;
    import com.pulumi.gcp.compute.inputs.GetInstanceGroupsArgs;
    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) {
            final var all = ComputeFunctions.getInstanceGroups(GetInstanceGroupsArgs.builder()
                .zone("us-central1-a")
                .build());
    
        }
    }
    
    variables:
      all:
        fn::invoke:
          function: gcp:compute:getInstanceGroups
          arguments:
            zone: us-central1-a
    
    pulumi {
      required_providers {
        gcp = {
          source = "pulumi/gcp"
        }
      }
    }
    
    data "gcp_compute_getinstancegroups" "all" {
      zone = "us-central1-a"
    }
    

    Using getInstanceGroups

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getInstanceGroups(args: GetInstanceGroupsArgs, opts?: InvokeOptions): Promise<GetInstanceGroupsResult>
    function getInstanceGroupsOutput(args: GetInstanceGroupsOutputArgs, opts?: InvokeOptions): Output<GetInstanceGroupsResult>
    def get_instance_groups(filter: Optional[str] = None,
                            project: Optional[str] = None,
                            zone: Optional[str] = None,
                            opts: Optional[InvokeOptions] = None) -> GetInstanceGroupsResult
    def get_instance_groups_output(filter: pulumi.Input[Optional[str]] = None,
                            project: pulumi.Input[Optional[str]] = None,
                            zone: pulumi.Input[Optional[str]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[GetInstanceGroupsResult]
    func GetInstanceGroups(ctx *Context, args *GetInstanceGroupsArgs, opts ...InvokeOption) (*GetInstanceGroupsResult, error)
    func GetInstanceGroupsOutput(ctx *Context, args *GetInstanceGroupsOutputArgs, opts ...InvokeOption) GetInstanceGroupsResultOutput

    > Note: This function is named GetInstanceGroups in the Go SDK.

    public static class GetInstanceGroups 
    {
        public static Task<GetInstanceGroupsResult> InvokeAsync(GetInstanceGroupsArgs args, InvokeOptions? opts = null)
        public static Output<GetInstanceGroupsResult> Invoke(GetInstanceGroupsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetInstanceGroupsResult> getInstanceGroups(GetInstanceGroupsArgs args, InvokeOptions options)
    public static Output<GetInstanceGroupsResult> getInstanceGroups(GetInstanceGroupsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: gcp:compute/getInstanceGroups:getInstanceGroups
      arguments:
        # arguments dictionary
    data "gcp_compute_get_instance_groups" "name" {
        # arguments
    }

    The following arguments are supported:

    Filter string
    A string filter as defined in the REST API.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Zone string
    The zone of the instance groups. If it is not provided, the provider zone is used.
    Filter string
    A string filter as defined in the REST API.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Zone string
    The zone of the instance groups. If it is not provided, the provider zone is used.
    filter string
    A string filter as defined in the REST API.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    zone string
    The zone of the instance groups. If it is not provided, the provider zone is used.
    filter String
    A string filter as defined in the REST API.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    zone String
    The zone of the instance groups. If it is not provided, the provider zone is used.
    filter string
    A string filter as defined in the REST API.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    zone string
    The zone of the instance groups. If it is not provided, the provider zone is used.
    filter str
    A string filter as defined in the REST API.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    zone str
    The zone of the instance groups. If it is not provided, the provider zone is used.
    filter String
    A string filter as defined in the REST API.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    zone String
    The zone of the instance groups. If it is not provided, the provider zone is used.

    getInstanceGroups Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    InstanceGroups List<GetInstanceGroupsInstanceGroup>
    A list of all retrieved GCE instance groups. Structure is defined below.
    Filter string
    Project string
    The ID of the project in which the resource belongs.
    Zone string
    The zone of the instance group.
    Id string
    The provider-assigned unique ID for this managed resource.
    InstanceGroups []GetInstanceGroupsInstanceGroup
    A list of all retrieved GCE instance groups. Structure is defined below.
    Filter string
    Project string
    The ID of the project in which the resource belongs.
    Zone string
    The zone of the instance group.
    id string
    The provider-assigned unique ID for this managed resource.
    instance_groups list(object)
    A list of all retrieved GCE instance groups. Structure is defined below.
    filter string
    project string
    The ID of the project in which the resource belongs.
    zone string
    The zone of the instance group.
    id String
    The provider-assigned unique ID for this managed resource.
    instanceGroups List<GetInstanceGroupsInstanceGroup>
    A list of all retrieved GCE instance groups. Structure is defined below.
    filter String
    project String
    The ID of the project in which the resource belongs.
    zone String
    The zone of the instance group.
    id string
    The provider-assigned unique ID for this managed resource.
    instanceGroups GetInstanceGroupsInstanceGroup[]
    A list of all retrieved GCE instance groups. Structure is defined below.
    filter string
    project string
    The ID of the project in which the resource belongs.
    zone string
    The zone of the instance group.
    id str
    The provider-assigned unique ID for this managed resource.
    instance_groups Sequence[GetInstanceGroupsInstanceGroup]
    A list of all retrieved GCE instance groups. Structure is defined below.
    filter str
    project str
    The ID of the project in which the resource belongs.
    zone str
    The zone of the instance group.
    id String
    The provider-assigned unique ID for this managed resource.
    instanceGroups List<Property Map>
    A list of all retrieved GCE instance groups. Structure is defined below.
    filter String
    project String
    The ID of the project in which the resource belongs.
    zone String
    The zone of the instance group.

    Supporting Types

    GetInstanceGroupsInstanceGroup

    DeletionPolicy string
    Whether Terraform will be prevented from destroying the instance. Defaults to "DELETE". When a 'terraform destroy' or 'terraform apply' would delete the instance, 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.
    Description string
    Textual description of the instance group.
    Name string
    The name of the instance group.
    NamedPorts List<GetInstanceGroupsInstanceGroupNamedPort>
    List of named ports in the group, as a list of objects, each with the following attributes:
    Network string
    The URL of the network the instance group is in.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    SelfLink string
    The URI of the resource.
    Size int
    The number of instances in the group.
    Zone string
    The zone of the instance groups. If it is not provided, the provider zone is used.
    DeletionPolicy string
    Whether Terraform will be prevented from destroying the instance. Defaults to "DELETE". When a 'terraform destroy' or 'terraform apply' would delete the instance, 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.
    Description string
    Textual description of the instance group.
    Name string
    The name of the instance group.
    NamedPorts []GetInstanceGroupsInstanceGroupNamedPort
    List of named ports in the group, as a list of objects, each with the following attributes:
    Network string
    The URL of the network the instance group is in.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    SelfLink string
    The URI of the resource.
    Size int
    The number of instances in the group.
    Zone string
    The zone of the instance groups. If it is not provided, the provider zone is used.
    deletion_policy string
    Whether Terraform will be prevented from destroying the instance. Defaults to "DELETE". When a 'terraform destroy' or 'terraform apply' would delete the instance, 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.
    description string
    Textual description of the instance group.
    name string
    The name of the instance group.
    named_ports list(object)
    List of named ports in the group, as a list of objects, each with the following attributes:
    network string
    The URL of the network the instance group is in.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    self_link string
    The URI of the resource.
    size number
    The number of instances in the group.
    zone string
    The zone of the instance groups. If it is not provided, the provider zone is used.
    deletionPolicy String
    Whether Terraform will be prevented from destroying the instance. Defaults to "DELETE". When a 'terraform destroy' or 'terraform apply' would delete the instance, 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.
    description String
    Textual description of the instance group.
    name String
    The name of the instance group.
    namedPorts List<GetInstanceGroupsInstanceGroupNamedPort>
    List of named ports in the group, as a list of objects, each with the following attributes:
    network String
    The URL of the network the instance group is in.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    selfLink String
    The URI of the resource.
    size Integer
    The number of instances in the group.
    zone String
    The zone of the instance groups. If it is not provided, the provider zone is used.
    deletionPolicy string
    Whether Terraform will be prevented from destroying the instance. Defaults to "DELETE". When a 'terraform destroy' or 'terraform apply' would delete the instance, 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.
    description string
    Textual description of the instance group.
    name string
    The name of the instance group.
    namedPorts GetInstanceGroupsInstanceGroupNamedPort[]
    List of named ports in the group, as a list of objects, each with the following attributes:
    network string
    The URL of the network the instance group is in.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    selfLink string
    The URI of the resource.
    size number
    The number of instances in the group.
    zone string
    The zone of the instance groups. If it is not provided, the provider zone is used.
    deletion_policy str
    Whether Terraform will be prevented from destroying the instance. Defaults to "DELETE". When a 'terraform destroy' or 'terraform apply' would delete the instance, 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.
    description str
    Textual description of the instance group.
    name str
    The name of the instance group.
    named_ports Sequence[GetInstanceGroupsInstanceGroupNamedPort]
    List of named ports in the group, as a list of objects, each with the following attributes:
    network str
    The URL of the network the instance group is in.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    self_link str
    The URI of the resource.
    size int
    The number of instances in the group.
    zone str
    The zone of the instance groups. If it is not provided, the provider zone is used.
    deletionPolicy String
    Whether Terraform will be prevented from destroying the instance. Defaults to "DELETE". When a 'terraform destroy' or 'terraform apply' would delete the instance, 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.
    description String
    Textual description of the instance group.
    name String
    The name of the instance group.
    namedPorts List<Property Map>
    List of named ports in the group, as a list of objects, each with the following attributes:
    network String
    The URL of the network the instance group is in.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    selfLink String
    The URI of the resource.
    size Number
    The number of instances in the group.
    zone String
    The zone of the instance groups. If it is not provided, the provider zone is used.

    GetInstanceGroupsInstanceGroupNamedPort

    Name string
    The name of the instance group.
    Port int
    The port number.
    Name string
    The name of the instance group.
    Port int
    The port number.
    name string
    The name of the instance group.
    port number
    The port number.
    name String
    The name of the instance group.
    port Integer
    The port number.
    name string
    The name of the instance group.
    port number
    The port number.
    name str
    The name of the instance group.
    port int
    The port number.
    name String
    The name of the instance group.
    port Number
    The port number.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Viewing docs for Google Cloud v9.32.1
    published on Wednesday, Jul 29, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial