1. Registry
  2. Packages
  3. Ibm Provider
  4. API Docs
  5. getDatabaseTasks
Viewing docs for ibm 2.9.0
published on Thursday, Nov 5, 2026 by ibm-cloud
ibm
Viewing docs for ibm 2.9.0
published on Thursday, Nov 5, 2026 by ibm-cloud

    Provides a read-only data source for database_tasks. Supports both Classic and Gen2 database instances. You can then reference the fields of the data source in other resources within the same configuration using interpolation syntax.

    Example Usage

    Classic

    import * as pulumi from "@pulumi/pulumi";
    import * as ibm from "@pulumi/ibm";
    
    const databaseTasks = ibm.getDatabaseTasks({
        deploymentId: database.id,
    });
    
    import pulumi
    import pulumi_ibm as ibm
    
    database_tasks = ibm.get_database_tasks(deployment_id=database["id"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/v2/ibm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ibm.GetDatabaseTasks(ctx, &ibm.GetDatabaseTasksArgs{
    			DeploymentId: database.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 databaseTasks = Ibm.GetDatabaseTasks.Invoke(new()
        {
            DeploymentId = database.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.GetDatabaseTasksArgs;
    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 databaseTasks = IbmFunctions.getDatabaseTasks(GetDatabaseTasksArgs.builder()
                .deploymentId(database.id())
                .build());
    
        }
    }
    
    variables:
      databaseTasks:
        fn::invoke:
          function: ibm:getDatabaseTasks
          arguments:
            deploymentId: ${database.id}
    
    Example coming soon!
    

    Gen2

    For Gen2 instances, the deployment_id is a Gen2 database instance CRN. The data source returns a single task representing the current instance state.

    import * as pulumi from "@pulumi/pulumi";
    import * as ibm from "@pulumi/ibm";
    
    const databaseTasks = ibm.getDatabaseTasks({
        deploymentId: "crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::",
    });
    
    import pulumi
    import pulumi_ibm as ibm
    
    database_tasks = ibm.get_database_tasks(deployment_id="crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/v2/ibm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ibm.GetDatabaseTasks(ctx, &ibm.GetDatabaseTasksArgs{
    			DeploymentId: "crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<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 databaseTasks = Ibm.GetDatabaseTasks.Invoke(new()
        {
            DeploymentId = "crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<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.GetDatabaseTasksArgs;
    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 databaseTasks = IbmFunctions.getDatabaseTasks(GetDatabaseTasksArgs.builder()
                .deploymentId("crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::")
                .build());
    
        }
    }
    
    variables:
      databaseTasks:
        fn::invoke:
          function: ibm:getDatabaseTasks
          arguments:
            deploymentId: 'crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::'
    
    Example coming soon!
    

    Gen2 Behaviour

    For Gen2 database instances, the data source derives task information from the current instance state via the Resource Controller API rather than the ICD tasks API. tasks always contains exactly one entry. The instance state is mapped to task attributes as follows:

    Instance Statestatusprogress_percent
    activecompleted100
    provisioning, preparingrunning50
    inactivequeued0
    failed, removedfailed0

    Using getDatabaseTasks

    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 getDatabaseTasks(args: GetDatabaseTasksArgs, opts?: InvokeOptions): Promise<GetDatabaseTasksResult>
    function getDatabaseTasksOutput(args: GetDatabaseTasksOutputArgs, opts?: InvokeOutputOptions): Output<GetDatabaseTasksResult>
    def get_database_tasks(deployment_id: Optional[str] = None,
                           id: Optional[str] = None,
                           opts: Optional[InvokeOptions] = None) -> GetDatabaseTasksResult
    def get_database_tasks_output(deployment_id: pulumi.Input[Optional[str]] = None,
                           id: pulumi.Input[Optional[str]] = None,
                           opts: Optional[InvokeOutputOptions] = None) -> Output[GetDatabaseTasksResult]
    func GetDatabaseTasks(ctx *Context, args *GetDatabaseTasksArgs, opts ...InvokeOption) (*GetDatabaseTasksResult, error)
    func GetDatabaseTasksOutput(ctx *Context, args *GetDatabaseTasksOutputArgs, opts ...InvokeOption) GetDatabaseTasksResultOutput

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

    public static class GetDatabaseTasks 
    {
        public static Task<GetDatabaseTasksResult> InvokeAsync(GetDatabaseTasksArgs args, InvokeOptions? opts = null)
        public static Output<GetDatabaseTasksResult> Invoke(GetDatabaseTasksInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetDatabaseTasksResult> Invoke(GetDatabaseTasksInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetDatabaseTasksResult> getDatabaseTasks(GetDatabaseTasksArgs args, InvokeOptions options)
    public static Output<GetDatabaseTasksResult> getDatabaseTasks(GetDatabaseTasksArgs args, InvokeOptions options)
    public static Output<GetDatabaseTasksResult> getDatabaseTasks(GetDatabaseTasksArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: ibm:index/getDatabaseTasks:getDatabaseTasks
      arguments:
        # arguments dictionary
    data "ibm_get_database_tasks" "name" {
        # arguments
    }

    The following arguments are supported:

    DeploymentId string

    Deployment ID.

    Classic: The database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:us-east:a/<account_id>:<instance_id>::
    

    Gen2: The Gen2 database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::
    

    The Gen2 deployment CRN can be retrieved from:

    • The id attribute of an ibm.Database resource configured with a Gen2 plan.
    • The IBM Cloud UI under Databases → your instance → Overview.
    Id string
    DeploymentId string

    Deployment ID.

    Classic: The database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:us-east:a/<account_id>:<instance_id>::
    

    Gen2: The Gen2 database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::
    

    The Gen2 deployment CRN can be retrieved from:

    • The id attribute of an ibm.Database resource configured with a Gen2 plan.
    • The IBM Cloud UI under Databases → your instance → Overview.
    Id string
    deployment_id string

    Deployment ID.

    Classic: The database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:us-east:a/<account_id>:<instance_id>::
    

    Gen2: The Gen2 database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::
    

    The Gen2 deployment CRN can be retrieved from:

    • The id attribute of an ibm.Database resource configured with a Gen2 plan.
    • The IBM Cloud UI under Databases → your instance → Overview.
    id string
    deploymentId String

    Deployment ID.

    Classic: The database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:us-east:a/<account_id>:<instance_id>::
    

    Gen2: The Gen2 database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::
    

    The Gen2 deployment CRN can be retrieved from:

    • The id attribute of an ibm.Database resource configured with a Gen2 plan.
    • The IBM Cloud UI under Databases → your instance → Overview.
    id String
    deploymentId string

    Deployment ID.

    Classic: The database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:us-east:a/<account_id>:<instance_id>::
    

    Gen2: The Gen2 database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::
    

    The Gen2 deployment CRN can be retrieved from:

    • The id attribute of an ibm.Database resource configured with a Gen2 plan.
    • The IBM Cloud UI under Databases → your instance → Overview.
    id string
    deployment_id str

    Deployment ID.

    Classic: The database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:us-east:a/<account_id>:<instance_id>::
    

    Gen2: The Gen2 database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::
    

    The Gen2 deployment CRN can be retrieved from:

    • The id attribute of an ibm.Database resource configured with a Gen2 plan.
    • The IBM Cloud UI under Databases → your instance → Overview.
    id str
    deploymentId String

    Deployment ID.

    Classic: The database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:us-east:a/<account_id>:<instance_id>::
    

    Gen2: The Gen2 database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::
    

    The Gen2 deployment CRN can be retrieved from:

    • The id attribute of an ibm.Database resource configured with a Gen2 plan.
    • The IBM Cloud UI under Databases → your instance → Overview.
    id String

    getDatabaseTasks Result

    The following output properties are available:

    DeploymentId string
    (Optional, String) ID of the deployment the task is being performed on.
    Id string
    Tasks List<GetDatabaseTasksTask>
    (Optional, List) An array of tasks. Always contains exactly one entry for Gen2 instances. Nested scheme for tasks:
    DeploymentId string
    (Optional, String) ID of the deployment the task is being performed on.
    Id string
    Tasks []GetDatabaseTasksTask
    (Optional, List) An array of tasks. Always contains exactly one entry for Gen2 instances. Nested scheme for tasks:
    deployment_id string
    (Optional, String) ID of the deployment the task is being performed on.
    id string
    tasks list(object)
    (Optional, List) An array of tasks. Always contains exactly one entry for Gen2 instances. Nested scheme for tasks:
    deploymentId String
    (Optional, String) ID of the deployment the task is being performed on.
    id String
    tasks List<GetDatabaseTasksTask>
    (Optional, List) An array of tasks. Always contains exactly one entry for Gen2 instances. Nested scheme for tasks:
    deploymentId string
    (Optional, String) ID of the deployment the task is being performed on.
    id string
    tasks GetDatabaseTasksTask[]
    (Optional, List) An array of tasks. Always contains exactly one entry for Gen2 instances. Nested scheme for tasks:
    deployment_id str
    (Optional, String) ID of the deployment the task is being performed on.
    id str
    tasks Sequence[GetDatabaseTasksTask]
    (Optional, List) An array of tasks. Always contains exactly one entry for Gen2 instances. Nested scheme for tasks:
    deploymentId String
    (Optional, String) ID of the deployment the task is being performed on.
    id String
    tasks List<Property Map>
    (Optional, List) An array of tasks. Always contains exactly one entry for Gen2 instances. Nested scheme for tasks:

    Supporting Types

    GetDatabaseTasksTask

    CreatedAt string
    (Optional, String) Date and time when the task was created.
    DeploymentId string

    Deployment ID.

    Classic: The database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:us-east:a/<account_id>:<instance_id>::
    

    Gen2: The Gen2 database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::
    

    The Gen2 deployment CRN can be retrieved from:

    • The id attribute of an ibm.Database resource configured with a Gen2 plan.
    • The IBM Cloud UI under Databases → your instance → Overview.
    Description string
    (Optional, String) Human-readable description of the task.
    ProgressPercent double
    (Optional, Integer) Indicator as percentage of progress of the task.
    Status string
    (Optional, String) The status of the task.

    • Constraints: Allowable values are: running, completed, failed, queued.
    TaskId string
    (Optional, String) ID of the task. Empty string "" for Gen2 instances.
    CreatedAt string
    (Optional, String) Date and time when the task was created.
    DeploymentId string

    Deployment ID.

    Classic: The database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:us-east:a/<account_id>:<instance_id>::
    

    Gen2: The Gen2 database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::
    

    The Gen2 deployment CRN can be retrieved from:

    • The id attribute of an ibm.Database resource configured with a Gen2 plan.
    • The IBM Cloud UI under Databases → your instance → Overview.
    Description string
    (Optional, String) Human-readable description of the task.
    ProgressPercent float64
    (Optional, Integer) Indicator as percentage of progress of the task.
    Status string
    (Optional, String) The status of the task.

    • Constraints: Allowable values are: running, completed, failed, queued.
    TaskId string
    (Optional, String) ID of the task. Empty string "" for Gen2 instances.
    created_at string
    (Optional, String) Date and time when the task was created.
    deployment_id string

    Deployment ID.

    Classic: The database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:us-east:a/<account_id>:<instance_id>::
    

    Gen2: The Gen2 database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::
    

    The Gen2 deployment CRN can be retrieved from:

    • The id attribute of an ibm.Database resource configured with a Gen2 plan.
    • The IBM Cloud UI under Databases → your instance → Overview.
    description string
    (Optional, String) Human-readable description of the task.
    progress_percent number
    (Optional, Integer) Indicator as percentage of progress of the task.
    status string
    (Optional, String) The status of the task.

    • Constraints: Allowable values are: running, completed, failed, queued.
    task_id string
    (Optional, String) ID of the task. Empty string "" for Gen2 instances.
    createdAt String
    (Optional, String) Date and time when the task was created.
    deploymentId String

    Deployment ID.

    Classic: The database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:us-east:a/<account_id>:<instance_id>::
    

    Gen2: The Gen2 database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::
    

    The Gen2 deployment CRN can be retrieved from:

    • The id attribute of an ibm.Database resource configured with a Gen2 plan.
    • The IBM Cloud UI under Databases → your instance → Overview.
    description String
    (Optional, String) Human-readable description of the task.
    progressPercent Double
    (Optional, Integer) Indicator as percentage of progress of the task.
    status String
    (Optional, String) The status of the task.

    • Constraints: Allowable values are: running, completed, failed, queued.
    taskId String
    (Optional, String) ID of the task. Empty string "" for Gen2 instances.
    createdAt string
    (Optional, String) Date and time when the task was created.
    deploymentId string

    Deployment ID.

    Classic: The database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:us-east:a/<account_id>:<instance_id>::
    

    Gen2: The Gen2 database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::
    

    The Gen2 deployment CRN can be retrieved from:

    • The id attribute of an ibm.Database resource configured with a Gen2 plan.
    • The IBM Cloud UI under Databases → your instance → Overview.
    description string
    (Optional, String) Human-readable description of the task.
    progressPercent number
    (Optional, Integer) Indicator as percentage of progress of the task.
    status string
    (Optional, String) The status of the task.

    • Constraints: Allowable values are: running, completed, failed, queued.
    taskId string
    (Optional, String) ID of the task. Empty string "" for Gen2 instances.
    created_at str
    (Optional, String) Date and time when the task was created.
    deployment_id str

    Deployment ID.

    Classic: The database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:us-east:a/<account_id>:<instance_id>::
    

    Gen2: The Gen2 database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::
    

    The Gen2 deployment CRN can be retrieved from:

    • The id attribute of an ibm.Database resource configured with a Gen2 plan.
    • The IBM Cloud UI under Databases → your instance → Overview.
    description str
    (Optional, String) Human-readable description of the task.
    progress_percent float
    (Optional, Integer) Indicator as percentage of progress of the task.
    status str
    (Optional, String) The status of the task.

    • Constraints: Allowable values are: running, completed, failed, queued.
    task_id str
    (Optional, String) ID of the task. Empty string "" for Gen2 instances.
    createdAt String
    (Optional, String) Date and time when the task was created.
    deploymentId String

    Deployment ID.

    Classic: The database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:us-east:a/<account_id>:<instance_id>::
    

    Gen2: The Gen2 database instance CRN, for example:

    crn:v1:bluemix:public:databases-for-postgresql:<region>:a/<account_id>:<instance_id>::
    

    The Gen2 deployment CRN can be retrieved from:

    • The id attribute of an ibm.Database resource configured with a Gen2 plan.
    • The IBM Cloud UI under Databases → your instance → Overview.
    description String
    (Optional, String) Human-readable description of the task.
    progressPercent Number
    (Optional, Integer) Indicator as percentage of progress of the task.
    status String
    (Optional, String) The status of the task.

    • Constraints: Allowable values are: running, completed, failed, queued.
    taskId String
    (Optional, String) ID of the task. Empty string "" for Gen2 instances.

    Package Details

    Repository
    ibm ibm-cloud/terraform-provider-ibm
    License
    Notes
    This Pulumi package is based on the ibm Terraform Provider.
    ibm
    Viewing docs for ibm 2.9.0
    published on Thursday, Nov 5, 2026 by ibm-cloud

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial