1. Packages
  2. Ibm Provider
  3. API Docs
  4. getResourceGroups
ibm 1.86.0 published on Wednesday, Dec 3, 2025 by ibm-cloud
ibm logo
ibm 1.86.0 published on Wednesday, Dec 3, 2025 by ibm-cloud

    Retrieve information about existing IBM resource groups as a read-only data source. For more information, about resource groups, see managing resource groups.

    Example Usage

    The following example retrieves all resource groups in the account.

    import * as pulumi from "@pulumi/pulumi";
    import * as ibm from "@pulumi/ibm";
    
    const groups = ibm.getResourceGroups({});
    
    import pulumi
    import pulumi_ibm as ibm
    
    groups = ibm.get_resource_groups()
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/ibm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ibm.GetResourceGroups(ctx, &ibm.GetResourceGroupsArgs{}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ibm = Pulumi.Ibm;
    
    return await Deployment.RunAsync(() => 
    {
        var groups = Ibm.GetResourceGroups.Invoke();
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ibm.IbmFunctions;
    import com.pulumi.ibm.inputs.GetResourceGroupsArgs;
    import java.util.List;
    import java.util.ArrayList;
    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 groups = IbmFunctions.getResourceGroups(GetResourceGroupsArgs.builder()
                .build());
    
        }
    }
    
    variables:
      groups:
        fn::invoke:
          function: ibm:getResourceGroups
          arguments: {}
    

    Example to retrieve resource groups by name

    import * as pulumi from "@pulumi/pulumi";
    import * as ibm from "@pulumi/ibm";
    
    const groups = ibm.getResourceGroups({
        name: "test",
    });
    
    import pulumi
    import pulumi_ibm as ibm
    
    groups = ibm.get_resource_groups(name="test")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/ibm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ibm.GetResourceGroups(ctx, &ibm.GetResourceGroupsArgs{
    			Name: pulumi.StringRef("test"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ibm = Pulumi.Ibm;
    
    return await Deployment.RunAsync(() => 
    {
        var groups = Ibm.GetResourceGroups.Invoke(new()
        {
            Name = "test",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ibm.IbmFunctions;
    import com.pulumi.ibm.inputs.GetResourceGroupsArgs;
    import java.util.List;
    import java.util.ArrayList;
    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 groups = IbmFunctions.getResourceGroups(GetResourceGroupsArgs.builder()
                .name("test")
                .build());
    
        }
    }
    
    variables:
      groups:
        fn::invoke:
          function: ibm:getResourceGroups
          arguments:
            name: test
    

    Example to retrieve default resource groups

    import * as pulumi from "@pulumi/pulumi";
    import * as ibm from "@pulumi/ibm";
    
    const groups = ibm.getResourceGroups({
        isDefault: true,
    });
    
    import pulumi
    import pulumi_ibm as ibm
    
    groups = ibm.get_resource_groups(is_default=True)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/ibm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ibm.GetResourceGroups(ctx, &ibm.GetResourceGroupsArgs{
    			IsDefault: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ibm = Pulumi.Ibm;
    
    return await Deployment.RunAsync(() => 
    {
        var groups = Ibm.GetResourceGroups.Invoke(new()
        {
            IsDefault = true,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ibm.IbmFunctions;
    import com.pulumi.ibm.inputs.GetResourceGroupsArgs;
    import java.util.List;
    import java.util.ArrayList;
    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 groups = IbmFunctions.getResourceGroups(GetResourceGroupsArgs.builder()
                .isDefault(true)
                .build());
    
        }
    }
    
    variables:
      groups:
        fn::invoke:
          function: ibm:getResourceGroups
          arguments:
            isDefault: true
    

    Example to include deleted resource groups

    import * as pulumi from "@pulumi/pulumi";
    import * as ibm from "@pulumi/ibm";
    
    const groups = ibm.getResourceGroups({
        includeDeleted: true,
    });
    
    import pulumi
    import pulumi_ibm as ibm
    
    groups = ibm.get_resource_groups(include_deleted=True)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/ibm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ibm.GetResourceGroups(ctx, &ibm.GetResourceGroupsArgs{
    			IncludeDeleted: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ibm = Pulumi.Ibm;
    
    return await Deployment.RunAsync(() => 
    {
        var groups = Ibm.GetResourceGroups.Invoke(new()
        {
            IncludeDeleted = true,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ibm.IbmFunctions;
    import com.pulumi.ibm.inputs.GetResourceGroupsArgs;
    import java.util.List;
    import java.util.ArrayList;
    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 groups = IbmFunctions.getResourceGroups(GetResourceGroupsArgs.builder()
                .includeDeleted(true)
                .build());
    
        }
    }
    
    variables:
      groups:
        fn::invoke:
          function: ibm:getResourceGroups
          arguments:
            includeDeleted: true
    

    Example to filter resource groups by date

    import * as pulumi from "@pulumi/pulumi";
    import * as ibm from "@pulumi/ibm";
    
    const groups = ibm.getResourceGroups({
        date: "2024-01",
    });
    
    import pulumi
    import pulumi_ibm as ibm
    
    groups = ibm.get_resource_groups(date="2024-01")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/ibm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ibm.GetResourceGroups(ctx, &ibm.GetResourceGroupsArgs{
    			Date: pulumi.StringRef("2024-01"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ibm = Pulumi.Ibm;
    
    return await Deployment.RunAsync(() => 
    {
        var groups = Ibm.GetResourceGroups.Invoke(new()
        {
            Date = "2024-01",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ibm.IbmFunctions;
    import com.pulumi.ibm.inputs.GetResourceGroupsArgs;
    import java.util.List;
    import java.util.ArrayList;
    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 groups = IbmFunctions.getResourceGroups(GetResourceGroupsArgs.builder()
                .date("2024-01")
                .build());
    
        }
    }
    
    variables:
      groups:
        fn::invoke:
          function: ibm:getResourceGroups
          arguments:
            date: 2024-01
    

    Usage notes

    • When no filters are specified, the data source returns all resource groups in the account.
    • The date parameter is useful for retrieving historical resource group information and excludes resource groups deleted before the specified month.
    • The include_deleted parameter allows you to retrieve resource groups that have been soft-deleted from the account.
    • The data source returns a list of resource groups, even when filtering by name or default status, as these filters could potentially match multiple resource groups.

    Using getResourceGroups

    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 getResourceGroups(args: GetResourceGroupsArgs, opts?: InvokeOptions): Promise<GetResourceGroupsResult>
    function getResourceGroupsOutput(args: GetResourceGroupsOutputArgs, opts?: InvokeOptions): Output<GetResourceGroupsResult>
    def get_resource_groups(date: Optional[str] = None,
                            id: Optional[str] = None,
                            include_deleted: Optional[bool] = None,
                            is_default: Optional[bool] = None,
                            name: Optional[str] = None,
                            opts: Optional[InvokeOptions] = None) -> GetResourceGroupsResult
    def get_resource_groups_output(date: Optional[pulumi.Input[str]] = None,
                            id: Optional[pulumi.Input[str]] = None,
                            include_deleted: Optional[pulumi.Input[bool]] = None,
                            is_default: Optional[pulumi.Input[bool]] = None,
                            name: Optional[pulumi.Input[str]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[GetResourceGroupsResult]
    func GetResourceGroups(ctx *Context, args *GetResourceGroupsArgs, opts ...InvokeOption) (*GetResourceGroupsResult, error)
    func GetResourceGroupsOutput(ctx *Context, args *GetResourceGroupsOutputArgs, opts ...InvokeOption) GetResourceGroupsResultOutput

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

    public static class GetResourceGroups 
    {
        public static Task<GetResourceGroupsResult> InvokeAsync(GetResourceGroupsArgs args, InvokeOptions? opts = null)
        public static Output<GetResourceGroupsResult> Invoke(GetResourceGroupsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetResourceGroupsResult> getResourceGroups(GetResourceGroupsArgs args, InvokeOptions options)
    public static Output<GetResourceGroupsResult> getResourceGroups(GetResourceGroupsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ibm:index/getResourceGroups:getResourceGroups
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Date string
    The date in YYYY-MM format to filter resource groups. Deleted resource groups are excluded before this month.
    Id string
    (String) The unique identifier of the resource group.
    IncludeDeleted bool
    Specifies whether to include deleted resource groups in the results.
    IsDefault bool
    Specifies whether to filter for default resource groups.
    Name string
    The name of an IBM Cloud resource group to filter by. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI.
    Date string
    The date in YYYY-MM format to filter resource groups. Deleted resource groups are excluded before this month.
    Id string
    (String) The unique identifier of the resource group.
    IncludeDeleted bool
    Specifies whether to include deleted resource groups in the results.
    IsDefault bool
    Specifies whether to filter for default resource groups.
    Name string
    The name of an IBM Cloud resource group to filter by. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI.
    date String
    The date in YYYY-MM format to filter resource groups. Deleted resource groups are excluded before this month.
    id String
    (String) The unique identifier of the resource group.
    includeDeleted Boolean
    Specifies whether to include deleted resource groups in the results.
    isDefault Boolean
    Specifies whether to filter for default resource groups.
    name String
    The name of an IBM Cloud resource group to filter by. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI.
    date string
    The date in YYYY-MM format to filter resource groups. Deleted resource groups are excluded before this month.
    id string
    (String) The unique identifier of the resource group.
    includeDeleted boolean
    Specifies whether to include deleted resource groups in the results.
    isDefault boolean
    Specifies whether to filter for default resource groups.
    name string
    The name of an IBM Cloud resource group to filter by. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI.
    date str
    The date in YYYY-MM format to filter resource groups. Deleted resource groups are excluded before this month.
    id str
    (String) The unique identifier of the resource group.
    include_deleted bool
    Specifies whether to include deleted resource groups in the results.
    is_default bool
    Specifies whether to filter for default resource groups.
    name str
    The name of an IBM Cloud resource group to filter by. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI.
    date String
    The date in YYYY-MM format to filter resource groups. Deleted resource groups are excluded before this month.
    id String
    (String) The unique identifier of the resource group.
    includeDeleted Boolean
    Specifies whether to include deleted resource groups in the results.
    isDefault Boolean
    Specifies whether to filter for default resource groups.
    name String
    The name of an IBM Cloud resource group to filter by. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI.

    getResourceGroups Result

    The following output properties are available:

    Id string
    (String) The unique identifier of the resource group.
    ResourceGroups List<GetResourceGroupsResourceGroup>
    (List of Objects) A list of resource groups matching the specified filters. Each resource group in the list has the following attributes:
    Date string
    IncludeDeleted bool
    IsDefault bool
    (Bool) Indicates whether this is the default resource group for the account.
    Name string
    (String) The human-readable name of the resource group.
    Id string
    (String) The unique identifier of the resource group.
    ResourceGroups []GetResourceGroupsResourceGroup
    (List of Objects) A list of resource groups matching the specified filters. Each resource group in the list has the following attributes:
    Date string
    IncludeDeleted bool
    IsDefault bool
    (Bool) Indicates whether this is the default resource group for the account.
    Name string
    (String) The human-readable name of the resource group.
    id String
    (String) The unique identifier of the resource group.
    resourceGroups List<GetResourceGroupsResourceGroup>
    (List of Objects) A list of resource groups matching the specified filters. Each resource group in the list has the following attributes:
    date String
    includeDeleted Boolean
    isDefault Boolean
    (Bool) Indicates whether this is the default resource group for the account.
    name String
    (String) The human-readable name of the resource group.
    id string
    (String) The unique identifier of the resource group.
    resourceGroups GetResourceGroupsResourceGroup[]
    (List of Objects) A list of resource groups matching the specified filters. Each resource group in the list has the following attributes:
    date string
    includeDeleted boolean
    isDefault boolean
    (Bool) Indicates whether this is the default resource group for the account.
    name string
    (String) The human-readable name of the resource group.
    id str
    (String) The unique identifier of the resource group.
    resource_groups Sequence[GetResourceGroupsResourceGroup]
    (List of Objects) A list of resource groups matching the specified filters. Each resource group in the list has the following attributes:
    date str
    include_deleted bool
    is_default bool
    (Bool) Indicates whether this is the default resource group for the account.
    name str
    (String) The human-readable name of the resource group.
    id String
    (String) The unique identifier of the resource group.
    resourceGroups List<Property Map>
    (List of Objects) A list of resource groups matching the specified filters. Each resource group in the list has the following attributes:
    date String
    includeDeleted Boolean
    isDefault Boolean
    (Bool) Indicates whether this is the default resource group for the account.
    name String
    (String) The human-readable name of the resource group.

    Supporting Types

    GetResourceGroupsResourceGroup

    AccountId string
    (String) The account ID that the resource group belongs to.
    CreatedAt string
    (String) The date and time when the resource group was initially created.
    Crn string
    (String) The full CRN (Cloud Resource Name) associated with the resource group.
    Id string
    (String) The unique identifier of the resource group.
    IsDefault bool
    Specifies whether to filter for default resource groups.
    Name string
    The name of an IBM Cloud resource group to filter by. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI.
    PaymentMethodsUrl string
    (String) The URL to access the payment methods details associated with the resource group.
    QuotaId string
    (String) An alpha-numeric value identifying the quota ID associated with the resource group.
    QuotaUrl string
    (String) The URL to access the quota details associated with the resource group.
    ResourceLinkages List<string>
    (List of Strings) An array of resource CRNs that are linked to the resource group.
    State string
    (String) The state of the resource group (e.g., ACTIVE, SUSPENDED).
    TeamsUrl string
    (String) The URL to access the team details associated with the resource group.
    UpdatedAt string
    (String) The date and time when the resource group was last updated.
    AccountId string
    (String) The account ID that the resource group belongs to.
    CreatedAt string
    (String) The date and time when the resource group was initially created.
    Crn string
    (String) The full CRN (Cloud Resource Name) associated with the resource group.
    Id string
    (String) The unique identifier of the resource group.
    IsDefault bool
    Specifies whether to filter for default resource groups.
    Name string
    The name of an IBM Cloud resource group to filter by. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI.
    PaymentMethodsUrl string
    (String) The URL to access the payment methods details associated with the resource group.
    QuotaId string
    (String) An alpha-numeric value identifying the quota ID associated with the resource group.
    QuotaUrl string
    (String) The URL to access the quota details associated with the resource group.
    ResourceLinkages []string
    (List of Strings) An array of resource CRNs that are linked to the resource group.
    State string
    (String) The state of the resource group (e.g., ACTIVE, SUSPENDED).
    TeamsUrl string
    (String) The URL to access the team details associated with the resource group.
    UpdatedAt string
    (String) The date and time when the resource group was last updated.
    accountId String
    (String) The account ID that the resource group belongs to.
    createdAt String
    (String) The date and time when the resource group was initially created.
    crn String
    (String) The full CRN (Cloud Resource Name) associated with the resource group.
    id String
    (String) The unique identifier of the resource group.
    isDefault Boolean
    Specifies whether to filter for default resource groups.
    name String
    The name of an IBM Cloud resource group to filter by. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI.
    paymentMethodsUrl String
    (String) The URL to access the payment methods details associated with the resource group.
    quotaId String
    (String) An alpha-numeric value identifying the quota ID associated with the resource group.
    quotaUrl String
    (String) The URL to access the quota details associated with the resource group.
    resourceLinkages List<String>
    (List of Strings) An array of resource CRNs that are linked to the resource group.
    state String
    (String) The state of the resource group (e.g., ACTIVE, SUSPENDED).
    teamsUrl String
    (String) The URL to access the team details associated with the resource group.
    updatedAt String
    (String) The date and time when the resource group was last updated.
    accountId string
    (String) The account ID that the resource group belongs to.
    createdAt string
    (String) The date and time when the resource group was initially created.
    crn string
    (String) The full CRN (Cloud Resource Name) associated with the resource group.
    id string
    (String) The unique identifier of the resource group.
    isDefault boolean
    Specifies whether to filter for default resource groups.
    name string
    The name of an IBM Cloud resource group to filter by. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI.
    paymentMethodsUrl string
    (String) The URL to access the payment methods details associated with the resource group.
    quotaId string
    (String) An alpha-numeric value identifying the quota ID associated with the resource group.
    quotaUrl string
    (String) The URL to access the quota details associated with the resource group.
    resourceLinkages string[]
    (List of Strings) An array of resource CRNs that are linked to the resource group.
    state string
    (String) The state of the resource group (e.g., ACTIVE, SUSPENDED).
    teamsUrl string
    (String) The URL to access the team details associated with the resource group.
    updatedAt string
    (String) The date and time when the resource group was last updated.
    account_id str
    (String) The account ID that the resource group belongs to.
    created_at str
    (String) The date and time when the resource group was initially created.
    crn str
    (String) The full CRN (Cloud Resource Name) associated with the resource group.
    id str
    (String) The unique identifier of the resource group.
    is_default bool
    Specifies whether to filter for default resource groups.
    name str
    The name of an IBM Cloud resource group to filter by. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI.
    payment_methods_url str
    (String) The URL to access the payment methods details associated with the resource group.
    quota_id str
    (String) An alpha-numeric value identifying the quota ID associated with the resource group.
    quota_url str
    (String) The URL to access the quota details associated with the resource group.
    resource_linkages Sequence[str]
    (List of Strings) An array of resource CRNs that are linked to the resource group.
    state str
    (String) The state of the resource group (e.g., ACTIVE, SUSPENDED).
    teams_url str
    (String) The URL to access the team details associated with the resource group.
    updated_at str
    (String) The date and time when the resource group was last updated.
    accountId String
    (String) The account ID that the resource group belongs to.
    createdAt String
    (String) The date and time when the resource group was initially created.
    crn String
    (String) The full CRN (Cloud Resource Name) associated with the resource group.
    id String
    (String) The unique identifier of the resource group.
    isDefault Boolean
    Specifies whether to filter for default resource groups.
    name String
    The name of an IBM Cloud resource group to filter by. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI.
    paymentMethodsUrl String
    (String) The URL to access the payment methods details associated with the resource group.
    quotaId String
    (String) An alpha-numeric value identifying the quota ID associated with the resource group.
    quotaUrl String
    (String) The URL to access the quota details associated with the resource group.
    resourceLinkages List<String>
    (List of Strings) An array of resource CRNs that are linked to the resource group.
    state String
    (String) The state of the resource group (e.g., ACTIVE, SUSPENDED).
    teamsUrl String
    (String) The URL to access the team details associated with the resource group.
    updatedAt String
    (String) The date and time when the resource group was last updated.

    Package Details

    Repository
    ibm ibm-cloud/terraform-provider-ibm
    License
    Notes
    This Pulumi package is based on the ibm Terraform Provider.
    ibm logo
    ibm 1.86.0 published on Wednesday, Dec 3, 2025 by ibm-cloud
      Meet Neo: Your AI Platform Teammate