civo logo
Civo v2.3.4, Mar 27 23

civo.getDatabase

Get information of an Database for use in other resources. This data source provides all of the Database’s properties as configured on your Civo account.

Note: This data source returns a single Database. When specifying a name, an error will be raised if more than one Databases with the same name found.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Civo = Pulumi.Civo;

return await Deployment.RunAsync(() => 
{
    var test = Civo.GetDatabase.Invoke(new()
    {
        Name = "test-database",
        Region = "LON1",
    });

});
package main

import (
	"github.com/pulumi/pulumi-civo/sdk/v2/go/civo"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := civo.LookupDatabase(ctx, &civo.LookupDatabaseArgs{
			Name:   pulumi.StringRef("test-database"),
			Region: pulumi.StringRef("LON1"),
		}, 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.civo.CivoFunctions;
import com.pulumi.civo.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 test = CivoFunctions.getDatabase(GetDatabaseArgs.builder()
            .name("test-database")
            .region("LON1")
            .build());

    }
}
import pulumi
import pulumi_civo as civo

test = civo.get_database(name="test-database",
    region="LON1")
import * as pulumi from "@pulumi/pulumi";
import * as civo from "@pulumi/civo";

const test = civo.getDatabase({
    name: "test-database",
    region: "LON1",
});
variables:
  test:
    fn::invoke:
      Function: civo:getDatabase
      Arguments:
        name: test-database
        region: LON1

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(id: Optional[str] = None,
                 name: Optional[str] = None,
                 region: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetDatabaseResult
def get_database_output(id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 region: 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)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: civo:index/getDatabase:getDatabase
  arguments:
    # arguments dictionary

The following arguments are supported:

Id string

The ID of the Database

Name string

The name of the Database

Region string

The region of an existing Database

Id string

The ID of the Database

Name string

The name of the Database

Region string

The region of an existing Database

id String

The ID of the Database

name String

The name of the Database

region String

The region of an existing Database

id string

The ID of the Database

name string

The name of the Database

region string

The region of an existing Database

id str

The ID of the Database

name str

The name of the Database

region str

The region of an existing Database

id String

The ID of the Database

name String

The name of the Database

region String

The region of an existing Database

getDatabase Result

The following output properties are available:

FirewallId string

The firewall id of the Database

NetworkId string

The network id of the Database

Nodes int

Count of nodes

Password string

The password of the database

Region string

The region of an existing Database

Size string

Size of the database

Status string

The status of the database

Username string

The username of the database

Id string

The ID of the Database

Name string

The name of the Database

FirewallId string

The firewall id of the Database

NetworkId string

The network id of the Database

Nodes int

Count of nodes

Password string

The password of the database

Region string

The region of an existing Database

Size string

Size of the database

Status string

The status of the database

Username string

The username of the database

Id string

The ID of the Database

Name string

The name of the Database

firewallId String

The firewall id of the Database

networkId String

The network id of the Database

nodes Integer

Count of nodes

password String

The password of the database

region String

The region of an existing Database

size String

Size of the database

status String

The status of the database

username String

The username of the database

id String

The ID of the Database

name String

The name of the Database

firewallId string

The firewall id of the Database

networkId string

The network id of the Database

nodes number

Count of nodes

password string

The password of the database

region string

The region of an existing Database

size string

Size of the database

status string

The status of the database

username string

The username of the database

id string

The ID of the Database

name string

The name of the Database

firewall_id str

The firewall id of the Database

network_id str

The network id of the Database

nodes int

Count of nodes

password str

The password of the database

region str

The region of an existing Database

size str

Size of the database

status str

The status of the database

username str

The username of the database

id str

The ID of the Database

name str

The name of the Database

firewallId String

The firewall id of the Database

networkId String

The network id of the Database

nodes Number

Count of nodes

password String

The password of the database

region String

The region of an existing Database

size String

Size of the database

status String

The status of the database

username String

The username of the database

id String

The ID of the Database

name String

The name of the Database

Package Details

Repository
Civo pulumi/pulumi-civo
License
Apache-2.0
Notes

This Pulumi package is based on the civo Terraform Provider.