1. Packages
  2. Ibm Provider
  3. API Docs
  4. getResourceGroup
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

ibm.getResourceGroup

Explore with Pulumi AI

ibm logo
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

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

    Example Usage

    The following example enables you to import the resource group by name.

    import * as pulumi from "@pulumi/pulumi";
    import * as ibm from "@pulumi/ibm";
    
    const group = ibm.getResourceGroup({
        name: "test",
    });
    
    import pulumi
    import pulumi_ibm as ibm
    
    group = ibm.get_resource_group(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.LookupResourceGroup(ctx, &ibm.LookupResourceGroupArgs{
    			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 @group = Ibm.GetResourceGroup.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.GetResourceGroupArgs;
    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 group = IbmFunctions.getResourceGroup(GetResourceGroupArgs.builder()
                .name("test")
                .build());
    
        }
    }
    
    variables:
      group:
        fn::invoke:
          function: ibm:getResourceGroup
          arguments:
            name: test
    

    Example to import the default resource group

    import * as pulumi from "@pulumi/pulumi";
    import * as ibm from "@pulumi/ibm";
    
    const group = ibm.getResourceGroup({
        isDefault: true,
    });
    
    import pulumi
    import pulumi_ibm as ibm
    
    group = ibm.get_resource_group(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.LookupResourceGroup(ctx, &ibm.LookupResourceGroupArgs{
    			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 @group = Ibm.GetResourceGroup.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.GetResourceGroupArgs;
    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 group = IbmFunctions.getResourceGroup(GetResourceGroupArgs.builder()
                .isDefault("true")
                .build());
    
        }
    }
    
    variables:
      group:
        fn::invoke:
          function: ibm:getResourceGroup
          arguments:
            isDefault: 'true'
    

    Using getResourceGroup

    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 getResourceGroup(args: GetResourceGroupArgs, opts?: InvokeOptions): Promise<GetResourceGroupResult>
    function getResourceGroupOutput(args: GetResourceGroupOutputArgs, opts?: InvokeOptions): Output<GetResourceGroupResult>
    def get_resource_group(id: Optional[str] = None,
                           is_default: Optional[bool] = None,
                           name: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetResourceGroupResult
    def get_resource_group_output(id: Optional[pulumi.Input[str]] = None,
                           is_default: Optional[pulumi.Input[bool]] = None,
                           name: Optional[pulumi.Input[str]] = None,
                           opts: Optional[InvokeOptions] = None) -> Output[GetResourceGroupResult]
    func LookupResourceGroup(ctx *Context, args *LookupResourceGroupArgs, opts ...InvokeOption) (*LookupResourceGroupResult, error)
    func LookupResourceGroupOutput(ctx *Context, args *LookupResourceGroupOutputArgs, opts ...InvokeOption) LookupResourceGroupResultOutput

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

    public static class GetResourceGroup 
    {
        public static Task<GetResourceGroupResult> InvokeAsync(GetResourceGroupArgs args, InvokeOptions? opts = null)
        public static Output<GetResourceGroupResult> Invoke(GetResourceGroupInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetResourceGroupResult> getResourceGroup(GetResourceGroupArgs args, InvokeOptions options)
    public static Output<GetResourceGroupResult> getResourceGroup(GetResourceGroupArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ibm:index/getResourceGroup:getResourceGroup
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    (String) The unique identifier of the new resource group.
    IsDefault bool
    Specifies whether you want to import default resource group. Note: Conflicts with the name.
    Name string
    The name of an IBM Cloud resource group. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI. Note: Conflicts with is_default.
    Id string
    (String) The unique identifier of the new resource group.
    IsDefault bool
    Specifies whether you want to import default resource group. Note: Conflicts with the name.
    Name string
    The name of an IBM Cloud resource group. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI. Note: Conflicts with is_default.
    id String
    (String) The unique identifier of the new resource group.
    isDefault Boolean
    Specifies whether you want to import default resource group. Note: Conflicts with the name.
    name String
    The name of an IBM Cloud resource group. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI. Note: Conflicts with is_default.
    id string
    (String) The unique identifier of the new resource group.
    isDefault boolean
    Specifies whether you want to import default resource group. Note: Conflicts with the name.
    name string
    The name of an IBM Cloud resource group. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI. Note: Conflicts with is_default.
    id str
    (String) The unique identifier of the new resource group.
    is_default bool
    Specifies whether you want to import default resource group. Note: Conflicts with the name.
    name str
    The name of an IBM Cloud resource group. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI. Note: Conflicts with is_default.
    id String
    (String) The unique identifier of the new resource group.
    isDefault Boolean
    Specifies whether you want to import default resource group. Note: Conflicts with the name.
    name String
    The name of an IBM Cloud resource group. You can retrieve the value by running the ibmcloud resource groups command in the IBM Cloud CLI. Note: Conflicts with is_default.

    getResourceGroup Result

    The following output properties are available:

    AccountId string
    (String) Account ID.
    CreatedAt string
    (Timestamp) The date when the resource group initially created.
    Crn string
    (String) The full CRN associated with the resource group.
    Id string
    (String) The unique identifier of the new resource group.
    IsDefault bool
    Name string
    PaymentMethodsUrl string
    (String) The URL to access the payment methods details that is 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 that is associated with the resource group.
    ResourceLinkages List<string>
    (String) An array of the resources that is linked to the resource group.
    State string
    (String) The state of the resource group.
    TeamsUrl string
    (String) The URL to access the team details that is associated with the resource group.
    UpdatedAt string
    (Timestamp) The date when the resource group last updated.
    AccountId string
    (String) Account ID.
    CreatedAt string
    (Timestamp) The date when the resource group initially created.
    Crn string
    (String) The full CRN associated with the resource group.
    Id string
    (String) The unique identifier of the new resource group.
    IsDefault bool
    Name string
    PaymentMethodsUrl string
    (String) The URL to access the payment methods details that is 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 that is associated with the resource group.
    ResourceLinkages []string
    (String) An array of the resources that is linked to the resource group.
    State string
    (String) The state of the resource group.
    TeamsUrl string
    (String) The URL to access the team details that is associated with the resource group.
    UpdatedAt string
    (Timestamp) The date when the resource group last updated.
    accountId String
    (String) Account ID.
    createdAt String
    (Timestamp) The date when the resource group initially created.
    crn String
    (String) The full CRN associated with the resource group.
    id String
    (String) The unique identifier of the new resource group.
    isDefault Boolean
    name String
    paymentMethodsUrl String
    (String) The URL to access the payment methods details that is 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 that is associated with the resource group.
    resourceLinkages List<String>
    (String) An array of the resources that is linked to the resource group.
    state String
    (String) The state of the resource group.
    teamsUrl String
    (String) The URL to access the team details that is associated with the resource group.
    updatedAt String
    (Timestamp) The date when the resource group last updated.
    accountId string
    (String) Account ID.
    createdAt string
    (Timestamp) The date when the resource group initially created.
    crn string
    (String) The full CRN associated with the resource group.
    id string
    (String) The unique identifier of the new resource group.
    isDefault boolean
    name string
    paymentMethodsUrl string
    (String) The URL to access the payment methods details that is 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 that is associated with the resource group.
    resourceLinkages string[]
    (String) An array of the resources that is linked to the resource group.
    state string
    (String) The state of the resource group.
    teamsUrl string
    (String) The URL to access the team details that is associated with the resource group.
    updatedAt string
    (Timestamp) The date when the resource group last updated.
    account_id str
    (String) Account ID.
    created_at str
    (Timestamp) The date when the resource group initially created.
    crn str
    (String) The full CRN associated with the resource group.
    id str
    (String) The unique identifier of the new resource group.
    is_default bool
    name str
    payment_methods_url str
    (String) The URL to access the payment methods details that is 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 that is associated with the resource group.
    resource_linkages Sequence[str]
    (String) An array of the resources that is linked to the resource group.
    state str
    (String) The state of the resource group.
    teams_url str
    (String) The URL to access the team details that is associated with the resource group.
    updated_at str
    (Timestamp) The date when the resource group last updated.
    accountId String
    (String) Account ID.
    createdAt String
    (Timestamp) The date when the resource group initially created.
    crn String
    (String) The full CRN associated with the resource group.
    id String
    (String) The unique identifier of the new resource group.
    isDefault Boolean
    name String
    paymentMethodsUrl String
    (String) The URL to access the payment methods details that is 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 that is associated with the resource group.
    resourceLinkages List<String>
    (String) An array of the resources that is linked to the resource group.
    state String
    (String) The state of the resource group.
    teamsUrl String
    (String) The URL to access the team details that is associated with the resource group.
    updatedAt String
    (Timestamp) The date when the resource group 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.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud