1. Packages
  2. Packages
  3. Aiven Provider
  4. API Docs
  5. getDatabase
Viewing docs for Aiven v5.6.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi
aiven logo
Viewing docs for Aiven v5.6.0 (Older version)
published on Monday, Mar 9, 2026 by Pulumi

    The Database data source provides information about the existing Aiven Database.

    ~>Deprecated The Database data source is deprecated, please use service-specific data sources instead, for example: aiven.PgDatabase, aiven.MysqlDatabase etc.

    Example Usage

    using System.Collections.Generic;
    using Pulumi;
    using Aiven = Pulumi.Aiven;
    
    return await Deployment.RunAsync(() => 
    {
        var mydatabase = Aiven.GetDatabase.Invoke(new()
        {
            Project = aiven_project.Myproject.Project,
            ServiceName = aiven_pg.Mypg.Service_name,
            DatabaseName = "<DATABASE_NAME>",
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aiven/sdk/v5/go/aiven"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := aiven.LookupDatabase(ctx, &aiven.LookupDatabaseArgs{
    			Project:      aiven_project.Myproject.Project,
    			ServiceName:  aiven_pg.Mypg.Service_name,
    			DatabaseName: "<DATABASE_NAME>",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aiven.AivenFunctions;
    import com.pulumi.aiven.inputs.GetDatabaseArgs;
    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 mydatabase = AivenFunctions.getDatabase(GetDatabaseArgs.builder()
                .project(aiven_project.myproject().project())
                .serviceName(aiven_pg.mypg().service_name())
                .databaseName("<DATABASE_NAME>")
                .build());
    
        }
    }
    
    import * as pulumi from "@pulumi/pulumi";
    import * as aiven from "@pulumi/aiven";
    
    const mydatabase = aiven.getDatabase({
        project: aiven_project.myproject.project,
        serviceName: aiven_pg.mypg.service_name,
        databaseName: "<DATABASE_NAME>",
    });
    
    import pulumi
    import pulumi_aiven as aiven
    
    mydatabase = aiven.get_database(project=aiven_project["myproject"]["project"],
        service_name=aiven_pg["mypg"]["service_name"],
        database_name="<DATABASE_NAME>")
    
    variables:
      mydatabase:
        fn::invoke:
          Function: aiven:getDatabase
          Arguments:
            project: ${aiven_project.myproject.project}
            serviceName: ${aiven_pg.mypg.service_name}
            databaseName: <DATABASE_NAME>
    

    Using getDatabase

    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 getDatabase(args: GetDatabaseArgs, opts?: InvokeOptions): Promise<GetDatabaseResult>
    function getDatabaseOutput(args: GetDatabaseOutputArgs, opts?: InvokeOptions): Output<GetDatabaseResult>
    def get_database(database_name: Optional[str] = None,
                     project: Optional[str] = None,
                     service_name: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetDatabaseResult
    def get_database_output(database_name: Optional[pulumi.Input[str]] = None,
                     project: Optional[pulumi.Input[str]] = None,
                     service_name: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetDatabaseResult]
    func LookupDatabase(ctx *Context, args *LookupDatabaseArgs, opts ...InvokeOption) (*LookupDatabaseResult, error)
    func LookupDatabaseOutput(ctx *Context, args *LookupDatabaseOutputArgs, opts ...InvokeOption) LookupDatabaseResultOutput

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

    public static class GetDatabase 
    {
        public static Task<GetDatabaseResult> InvokeAsync(GetDatabaseArgs args, InvokeOptions? opts = null)
        public static Output<GetDatabaseResult> Invoke(GetDatabaseInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetDatabaseResult> getDatabase(GetDatabaseArgs args, InvokeOptions options)
    public static Output<GetDatabaseResult> getDatabase(GetDatabaseArgs args, InvokeOptions options)
    
    fn::invoke:
      function: aiven:index/getDatabase:getDatabase
      arguments:
        # arguments dictionary

    The following arguments are supported:

    DatabaseName string
    The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
    Project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    ServiceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    DatabaseName string
    The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
    Project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    ServiceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    databaseName String
    The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
    project String
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    serviceName String
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    databaseName string
    The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
    project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    serviceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    database_name str
    The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
    project str
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    service_name str
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    databaseName String
    The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
    project String
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    serviceName String
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.

    getDatabase Result

    The following output properties are available:

    DatabaseName string
    The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    LcCollate string
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. This property cannot be changed, doing so forces recreation of the resource.
    LcCtype string
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. This property cannot be changed, doing so forces recreation of the resource.
    Project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    ServiceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    TerminationProtection bool
    DatabaseName string
    The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    LcCollate string
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. This property cannot be changed, doing so forces recreation of the resource.
    LcCtype string
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. This property cannot be changed, doing so forces recreation of the resource.
    Project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    ServiceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    TerminationProtection bool
    databaseName String
    The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
    id String
    The provider-assigned unique ID for this managed resource.
    lcCollate String
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. This property cannot be changed, doing so forces recreation of the resource.
    lcCtype String
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. This property cannot be changed, doing so forces recreation of the resource.
    project String
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    serviceName String
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    terminationProtection Boolean
    databaseName string
    The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
    id string
    The provider-assigned unique ID for this managed resource.
    lcCollate string
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. This property cannot be changed, doing so forces recreation of the resource.
    lcCtype string
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. This property cannot be changed, doing so forces recreation of the resource.
    project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    serviceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    terminationProtection boolean
    database_name str
    The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
    id str
    The provider-assigned unique ID for this managed resource.
    lc_collate str
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. This property cannot be changed, doing so forces recreation of the resource.
    lc_ctype str
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. This property cannot be changed, doing so forces recreation of the resource.
    project str
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    service_name str
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    termination_protection bool
    databaseName String
    The name of the service database. This property cannot be changed, doing so forces recreation of the resource.
    id String
    The provider-assigned unique ID for this managed resource.
    lcCollate String
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. This property cannot be changed, doing so forces recreation of the resource.
    lcCtype String
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. This property cannot be changed, doing so forces recreation of the resource.
    project String
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    serviceName String
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. This property cannot be changed, doing so forces recreation of the resource.
    terminationProtection Boolean

    Package Details

    Repository
    Aiven pulumi/pulumi-aiven
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aiven Terraform Provider.
    aiven logo
    Viewing docs for Aiven v5.6.0 (Older version)
    published on Monday, Mar 9, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.