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

ibm.getResourceInstance

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 instance from IBM Cloud as a read-only data source. For more information, about resource instance, see ibmcloud resource service-instance.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ibm from "@pulumi/ibm";
    
    const group = ibm.getResourceGroup({
        name: "default",
    });
    const testaccDsResourceInstance = group.then(group => ibm.getResourceInstance({
        name: "myobjectstore",
        location: "global",
        resourceGroupId: group.id,
        service: "cloud-object-storage",
    }));
    const testaccDsResourceInstanceIdentifier = ibm.getResourceInstance({
        identifier: ibm_resource_instance.instance.id,
    });
    
    import pulumi
    import pulumi_ibm as ibm
    
    group = ibm.get_resource_group(name="default")
    testacc_ds_resource_instance = ibm.get_resource_instance(name="myobjectstore",
        location="global",
        resource_group_id=group.id,
        service="cloud-object-storage")
    testacc_ds_resource_instance_identifier = ibm.get_resource_instance(identifier=ibm_resource_instance["instance"]["id"])
    
    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 {
    		group, err := ibm.LookupResourceGroup(ctx, &ibm.LookupResourceGroupArgs{
    			Name: pulumi.StringRef("default"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = ibm.LookupResourceInstance(ctx, &ibm.LookupResourceInstanceArgs{
    			Name:            pulumi.StringRef("myobjectstore"),
    			Location:        pulumi.StringRef("global"),
    			ResourceGroupId: pulumi.StringRef(group.Id),
    			Service:         pulumi.StringRef("cloud-object-storage"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = ibm.LookupResourceInstance(ctx, &ibm.LookupResourceInstanceArgs{
    			Identifier: pulumi.StringRef(ibm_resource_instance.Instance.Id),
    		}, 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 = "default",
        });
    
        var testaccDsResourceInstance = Ibm.GetResourceInstance.Invoke(new()
        {
            Name = "myobjectstore",
            Location = "global",
            ResourceGroupId = @group.Apply(getResourceGroupResult => getResourceGroupResult.Id),
            Service = "cloud-object-storage",
        });
    
        var testaccDsResourceInstanceIdentifier = Ibm.GetResourceInstance.Invoke(new()
        {
            Identifier = ibm_resource_instance.Instance.Id,
        });
    
    });
    
    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 com.pulumi.ibm.inputs.GetResourceInstanceArgs;
    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("default")
                .build());
    
            final var testaccDsResourceInstance = IbmFunctions.getResourceInstance(GetResourceInstanceArgs.builder()
                .name("myobjectstore")
                .location("global")
                .resourceGroupId(group.applyValue(getResourceGroupResult -> getResourceGroupResult.id()))
                .service("cloud-object-storage")
                .build());
    
            final var testaccDsResourceInstanceIdentifier = IbmFunctions.getResourceInstance(GetResourceInstanceArgs.builder()
                .identifier(ibm_resource_instance.instance().id())
                .build());
    
        }
    }
    
    variables:
      group:
        fn::invoke:
          function: ibm:getResourceGroup
          arguments:
            name: default
      testaccDsResourceInstance:
        fn::invoke:
          function: ibm:getResourceInstance
          arguments:
            name: myobjectstore
            location: global
            resourceGroupId: ${group.id}
            service: cloud-object-storage
      testaccDsResourceInstanceIdentifier:
        fn::invoke:
          function: ibm:getResourceInstance
          arguments:
            identifier: ${ibm_resource_instance.instance.id}
    

    Using getResourceInstance

    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 getResourceInstance(args: GetResourceInstanceArgs, opts?: InvokeOptions): Promise<GetResourceInstanceResult>
    function getResourceInstanceOutput(args: GetResourceInstanceOutputArgs, opts?: InvokeOptions): Output<GetResourceInstanceResult>
    def get_resource_instance(id: Optional[str] = None,
                              identifier: Optional[str] = None,
                              location: Optional[str] = None,
                              name: Optional[str] = None,
                              resource_group_id: Optional[str] = None,
                              service: Optional[str] = None,
                              opts: Optional[InvokeOptions] = None) -> GetResourceInstanceResult
    def get_resource_instance_output(id: Optional[pulumi.Input[str]] = None,
                              identifier: Optional[pulumi.Input[str]] = None,
                              location: Optional[pulumi.Input[str]] = None,
                              name: Optional[pulumi.Input[str]] = None,
                              resource_group_id: Optional[pulumi.Input[str]] = None,
                              service: Optional[pulumi.Input[str]] = None,
                              opts: Optional[InvokeOptions] = None) -> Output[GetResourceInstanceResult]
    func LookupResourceInstance(ctx *Context, args *LookupResourceInstanceArgs, opts ...InvokeOption) (*LookupResourceInstanceResult, error)
    func LookupResourceInstanceOutput(ctx *Context, args *LookupResourceInstanceOutputArgs, opts ...InvokeOption) LookupResourceInstanceResultOutput

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

    public static class GetResourceInstance 
    {
        public static Task<GetResourceInstanceResult> InvokeAsync(GetResourceInstanceArgs args, InvokeOptions? opts = null)
        public static Output<GetResourceInstanceResult> Invoke(GetResourceInstanceInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetResourceInstanceResult> getResourceInstance(GetResourceInstanceArgs args, InvokeOptions options)
    public static Output<GetResourceInstanceResult> getResourceInstance(GetResourceInstanceArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ibm:index/getResourceInstance:getResourceInstance
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    (String) The unique identifier of the resource instance.
    Identifier string
    The GUID of the resource instance. Conflicts with other arguments.
    Location string
    The location or the environment in which the instance exists.
    Name string
    The name of the resource instance.
    ResourceGroupId string
    The ID of the resource group where the resource instance exists. If not provided it takes the default resource group.
    Service string
    The service type of the instance. You can retrieve the value by executing the ibmcloud catalog service-marketplace or ibmcloud catalog search command in the IBM Cloud CLI.
    Id string
    (String) The unique identifier of the resource instance.
    Identifier string
    The GUID of the resource instance. Conflicts with other arguments.
    Location string
    The location or the environment in which the instance exists.
    Name string
    The name of the resource instance.
    ResourceGroupId string
    The ID of the resource group where the resource instance exists. If not provided it takes the default resource group.
    Service string
    The service type of the instance. You can retrieve the value by executing the ibmcloud catalog service-marketplace or ibmcloud catalog search command in the IBM Cloud CLI.
    id String
    (String) The unique identifier of the resource instance.
    identifier String
    The GUID of the resource instance. Conflicts with other arguments.
    location String
    The location or the environment in which the instance exists.
    name String
    The name of the resource instance.
    resourceGroupId String
    The ID of the resource group where the resource instance exists. If not provided it takes the default resource group.
    service String
    The service type of the instance. You can retrieve the value by executing the ibmcloud catalog service-marketplace or ibmcloud catalog search command in the IBM Cloud CLI.
    id string
    (String) The unique identifier of the resource instance.
    identifier string
    The GUID of the resource instance. Conflicts with other arguments.
    location string
    The location or the environment in which the instance exists.
    name string
    The name of the resource instance.
    resourceGroupId string
    The ID of the resource group where the resource instance exists. If not provided it takes the default resource group.
    service string
    The service type of the instance. You can retrieve the value by executing the ibmcloud catalog service-marketplace or ibmcloud catalog search command in the IBM Cloud CLI.
    id str
    (String) The unique identifier of the resource instance.
    identifier str
    The GUID of the resource instance. Conflicts with other arguments.
    location str
    The location or the environment in which the instance exists.
    name str
    The name of the resource instance.
    resource_group_id str
    The ID of the resource group where the resource instance exists. If not provided it takes the default resource group.
    service str
    The service type of the instance. You can retrieve the value by executing the ibmcloud catalog service-marketplace or ibmcloud catalog search command in the IBM Cloud CLI.
    id String
    (String) The unique identifier of the resource instance.
    identifier String
    The GUID of the resource instance. Conflicts with other arguments.
    location String
    The location or the environment in which the instance exists.
    name String
    The name of the resource instance.
    resourceGroupId String
    The ID of the resource group where the resource instance exists. If not provided it takes the default resource group.
    service String
    The service type of the instance. You can retrieve the value by executing the ibmcloud catalog service-marketplace or ibmcloud catalog search command in the IBM Cloud CLI.

    getResourceInstance Result

    The following output properties are available:

    Crn string
    Extensions Dictionary<string, string>
    (String) The extended metadata as a map associated with the resource instance.
    Guid string
    (String) The GUID of the resource instance.
    Id string
    (String) The unique identifier of the resource instance.
    Location string
    Name string
    OnetimeCredentials bool
    (Bool) A boolean that dictates if the onetime_credentials is true or false.
    ParametersJson string
    (String) The parameters associated with the instance in json format.
    Plan string
    (String) The plan for the service offering used by this resource instance.
    ResourceControllerUrl string
    ResourceCrn string
    ResourceGroupId string
    ResourceGroupName string
    ResourceName string
    ResourceStatus string
    Service string
    Status string
    (String) The status of resource instance.
    Tags List<string>
    Identifier string
    Crn string
    Extensions map[string]string
    (String) The extended metadata as a map associated with the resource instance.
    Guid string
    (String) The GUID of the resource instance.
    Id string
    (String) The unique identifier of the resource instance.
    Location string
    Name string
    OnetimeCredentials bool
    (Bool) A boolean that dictates if the onetime_credentials is true or false.
    ParametersJson string
    (String) The parameters associated with the instance in json format.
    Plan string
    (String) The plan for the service offering used by this resource instance.
    ResourceControllerUrl string
    ResourceCrn string
    ResourceGroupId string
    ResourceGroupName string
    ResourceName string
    ResourceStatus string
    Service string
    Status string
    (String) The status of resource instance.
    Tags []string
    Identifier string
    crn String
    extensions Map<String,String>
    (String) The extended metadata as a map associated with the resource instance.
    guid String
    (String) The GUID of the resource instance.
    id String
    (String) The unique identifier of the resource instance.
    location String
    name String
    onetimeCredentials Boolean
    (Bool) A boolean that dictates if the onetime_credentials is true or false.
    parametersJson String
    (String) The parameters associated with the instance in json format.
    plan String
    (String) The plan for the service offering used by this resource instance.
    resourceControllerUrl String
    resourceCrn String
    resourceGroupId String
    resourceGroupName String
    resourceName String
    resourceStatus String
    service String
    status String
    (String) The status of resource instance.
    tags List<String>
    identifier String
    crn string
    extensions {[key: string]: string}
    (String) The extended metadata as a map associated with the resource instance.
    guid string
    (String) The GUID of the resource instance.
    id string
    (String) The unique identifier of the resource instance.
    location string
    name string
    onetimeCredentials boolean
    (Bool) A boolean that dictates if the onetime_credentials is true or false.
    parametersJson string
    (String) The parameters associated with the instance in json format.
    plan string
    (String) The plan for the service offering used by this resource instance.
    resourceControllerUrl string
    resourceCrn string
    resourceGroupId string
    resourceGroupName string
    resourceName string
    resourceStatus string
    service string
    status string
    (String) The status of resource instance.
    tags string[]
    identifier string
    crn str
    extensions Mapping[str, str]
    (String) The extended metadata as a map associated with the resource instance.
    guid str
    (String) The GUID of the resource instance.
    id str
    (String) The unique identifier of the resource instance.
    location str
    name str
    onetime_credentials bool
    (Bool) A boolean that dictates if the onetime_credentials is true or false.
    parameters_json str
    (String) The parameters associated with the instance in json format.
    plan str
    (String) The plan for the service offering used by this resource instance.
    resource_controller_url str
    resource_crn str
    resource_group_id str
    resource_group_name str
    resource_name str
    resource_status str
    service str
    status str
    (String) The status of resource instance.
    tags Sequence[str]
    identifier str
    crn String
    extensions Map<String>
    (String) The extended metadata as a map associated with the resource instance.
    guid String
    (String) The GUID of the resource instance.
    id String
    (String) The unique identifier of the resource instance.
    location String
    name String
    onetimeCredentials Boolean
    (Bool) A boolean that dictates if the onetime_credentials is true or false.
    parametersJson String
    (String) The parameters associated with the instance in json format.
    plan String
    (String) The plan for the service offering used by this resource instance.
    resourceControllerUrl String
    resourceCrn String
    resourceGroupId String
    resourceGroupName String
    resourceName String
    resourceStatus String
    service String
    status String
    (String) The status of resource instance.
    tags List<String>
    identifier String

    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