1. Packages
  2. Linode Provider
  3. API Docs
  4. getDatabases
Linode v4.36.0 published on Thursday, Mar 27, 2025 by Pulumi

linode.getDatabases

Explore with Pulumi AI

Linode v4.36.0 published on Thursday, Mar 27, 2025 by Pulumi

Provides information about Linode Managed Databases that match a set of filters. For more information, see the Linode APIv4 docs.

Example Usage

Get information about all Linode Managed Databases:

import * as pulumi from "@pulumi/pulumi";
import * as linode from "@pulumi/linode";

const all = linode.getDatabases({});
export const databaseIds = all.then(all => all.databases.map(__item => __item.id));
Copy
import pulumi
import pulumi_linode as linode

all = linode.get_databases()
pulumi.export("databaseIds", [__item.id for __item in all.databases])
Copy
package main

import (
	"github.com/pulumi/pulumi-linode/sdk/v4/go/linode"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
all, err := linode.GetDatabases(ctx, &linode.GetDatabasesArgs{
}, nil);
if err != nil {
return err
}
ctx.Export("databaseIds", pulumi.IntArray(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:3,11-30)))
return nil
})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Linode = Pulumi.Linode;

return await Deployment.RunAsync(() => 
{
    var all = Linode.GetDatabases.Invoke();

    return new Dictionary<string, object?>
    {
        ["databaseIds"] = all.Apply(getDatabasesResult => getDatabasesResult.Databases).Select(__item => __item.Id).ToList(),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.linode.LinodeFunctions;
import com.pulumi.linode.inputs.GetDatabasesArgs;
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 all = LinodeFunctions.getDatabases();

        ctx.export("databaseIds", all.applyValue(getDatabasesResult -> getDatabasesResult.databases()).stream().map(element -> element.id()).collect(toList()));
    }
}
Copy
Coming soon!

Get information about all Linode MySQL Databases:

import * as pulumi from "@pulumi/pulumi";
import * as linode from "@pulumi/linode";

const mysql = linode.getDatabases({
    filters: [{
        name: "engine",
        values: ["mysql"],
    }],
});
export const databaseIds = mysql.then(mysql => mysql.databases.map(__item => __item.id));
Copy
import pulumi
import pulumi_linode as linode

mysql = linode.get_databases(filters=[{
    "name": "engine",
    "values": ["mysql"],
}])
pulumi.export("databaseIds", [__item.id for __item in mysql.databases])
Copy
package main

import (
	"github.com/pulumi/pulumi-linode/sdk/v4/go/linode"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
mysql, err := linode.GetDatabases(ctx, &linode.GetDatabasesArgs{
Filters: []linode.GetDatabasesFilter{
{
Name: "engine",
Values: []string{
"mysql",
},
},
},
}, nil);
if err != nil {
return err
}
ctx.Export("databaseIds", pulumi.IntArray(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:8,11-32)))
return nil
})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Linode = Pulumi.Linode;

return await Deployment.RunAsync(() => 
{
    var mysql = Linode.GetDatabases.Invoke(new()
    {
        Filters = new[]
        {
            new Linode.Inputs.GetDatabasesFilterInputArgs
            {
                Name = "engine",
                Values = new[]
                {
                    "mysql",
                },
            },
        },
    });

    return new Dictionary<string, object?>
    {
        ["databaseIds"] = mysql.Apply(getDatabasesResult => getDatabasesResult.Databases).Select(__item => __item.Id).ToList(),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.linode.LinodeFunctions;
import com.pulumi.linode.inputs.GetDatabasesArgs;
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 mysql = LinodeFunctions.getDatabases(GetDatabasesArgs.builder()
            .filters(GetDatabasesFilterArgs.builder()
                .name("engine")
                .values("mysql")
                .build())
            .build());

        ctx.export("databaseIds", mysql.applyValue(getDatabasesResult -> getDatabasesResult.databases()).stream().map(element -> element.id()).collect(toList()));
    }
}
Copy
Coming soon!

Using getDatabases

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 getDatabases(args: GetDatabasesArgs, opts?: InvokeOptions): Promise<GetDatabasesResult>
function getDatabasesOutput(args: GetDatabasesOutputArgs, opts?: InvokeOptions): Output<GetDatabasesResult>
Copy
def get_databases(databases: Optional[Sequence[GetDatabasesDatabase]] = None,
                  filters: Optional[Sequence[GetDatabasesFilter]] = None,
                  order: Optional[str] = None,
                  order_by: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetDatabasesResult
def get_databases_output(databases: Optional[pulumi.Input[Sequence[pulumi.Input[GetDatabasesDatabaseArgs]]]] = None,
                  filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetDatabasesFilterArgs]]]] = None,
                  order: Optional[pulumi.Input[str]] = None,
                  order_by: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetDatabasesResult]
Copy
func GetDatabases(ctx *Context, args *GetDatabasesArgs, opts ...InvokeOption) (*GetDatabasesResult, error)
func GetDatabasesOutput(ctx *Context, args *GetDatabasesOutputArgs, opts ...InvokeOption) GetDatabasesResultOutput
Copy

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

public static class GetDatabases 
{
    public static Task<GetDatabasesResult> InvokeAsync(GetDatabasesArgs args, InvokeOptions? opts = null)
    public static Output<GetDatabasesResult> Invoke(GetDatabasesInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetDatabasesResult> getDatabases(GetDatabasesArgs args, InvokeOptions options)
public static Output<GetDatabasesResult> getDatabases(GetDatabasesArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: linode:index/getDatabases:getDatabases
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Databases List<GetDatabasesDatabase>
Filters List<GetDatabasesFilter>
Order string
The order in which results should be returned. (asc, desc; default asc)
OrderBy string
The attribute to order the results by. (version)
Databases []GetDatabasesDatabase
Filters []GetDatabasesFilter
Order string
The order in which results should be returned. (asc, desc; default asc)
OrderBy string
The attribute to order the results by. (version)
databases List<GetDatabasesDatabase>
filters List<GetDatabasesFilter>
order String
The order in which results should be returned. (asc, desc; default asc)
orderBy String
The attribute to order the results by. (version)
databases GetDatabasesDatabase[]
filters GetDatabasesFilter[]
order string
The order in which results should be returned. (asc, desc; default asc)
orderBy string
The attribute to order the results by. (version)
databases Sequence[GetDatabasesDatabase]
filters Sequence[GetDatabasesFilter]
order str
The order in which results should be returned. (asc, desc; default asc)
order_by str
The attribute to order the results by. (version)
databases List<Property Map>
filters List<Property Map>
order String
The order in which results should be returned. (asc, desc; default asc)
orderBy String
The attribute to order the results by. (version)

getDatabases Result

The following output properties are available:

Id string
The ID of the Managed Database.
Databases List<GetDatabasesDatabase>
Filters List<GetDatabasesFilter>
Order string
OrderBy string
Id string
The ID of the Managed Database.
Databases []GetDatabasesDatabase
Filters []GetDatabasesFilter
Order string
OrderBy string
id String
The ID of the Managed Database.
databases List<GetDatabasesDatabase>
filters List<GetDatabasesFilter>
order String
orderBy String
id string
The ID of the Managed Database.
databases GetDatabasesDatabase[]
filters GetDatabasesFilter[]
order string
orderBy string
id String
The ID of the Managed Database.
databases List<Property Map>
filters List<Property Map>
order String
orderBy String

Supporting Types

GetDatabasesDatabase

AllowLists This property is required. List<string>
A list of IP addresses that can access the Managed Database.
ClusterSize This property is required. int
The number of Linode Instance nodes deployed to the Managed Database.
Created This property is required. string
When this Managed Database was created.
Encrypted This property is required. bool
Whether the Managed Databases is encrypted.
Engine This property is required. string
The Managed Database engine.
HostPrimary This property is required. string
The primary host for the Managed Database.
HostSecondary This property is required. string
The secondary/private network host for the Managed Database.
Id This property is required. int
The ID of the Managed Database.
InstanceUri This property is required. string
he API route for the database instance.
Label This property is required. string
A unique, user-defined string referring to the Managed Database.
Region This property is required. string
The region to use for the Managed Database.
ReplicationType This property is required. string
The replication method used for the Managed Database.
SslConnection This property is required. bool
Whether to require SSL credentials to establish a connection to the Managed Database.
Status This property is required. string
The operating status of the Managed Database.
Type This property is required. string
The Linode Instance type used for the nodes of the Managed Database instance.
Updated This property is required. string
When this Managed Database was last updated.
Version This property is required. string
The Managed Database engine version.
AllowLists This property is required. []string
A list of IP addresses that can access the Managed Database.
ClusterSize This property is required. int
The number of Linode Instance nodes deployed to the Managed Database.
Created This property is required. string
When this Managed Database was created.
Encrypted This property is required. bool
Whether the Managed Databases is encrypted.
Engine This property is required. string
The Managed Database engine.
HostPrimary This property is required. string
The primary host for the Managed Database.
HostSecondary This property is required. string
The secondary/private network host for the Managed Database.
Id This property is required. int
The ID of the Managed Database.
InstanceUri This property is required. string
he API route for the database instance.
Label This property is required. string
A unique, user-defined string referring to the Managed Database.
Region This property is required. string
The region to use for the Managed Database.
ReplicationType This property is required. string
The replication method used for the Managed Database.
SslConnection This property is required. bool
Whether to require SSL credentials to establish a connection to the Managed Database.
Status This property is required. string
The operating status of the Managed Database.
Type This property is required. string
The Linode Instance type used for the nodes of the Managed Database instance.
Updated This property is required. string
When this Managed Database was last updated.
Version This property is required. string
The Managed Database engine version.
allowLists This property is required. List<String>
A list of IP addresses that can access the Managed Database.
clusterSize This property is required. Integer
The number of Linode Instance nodes deployed to the Managed Database.
created This property is required. String
When this Managed Database was created.
encrypted This property is required. Boolean
Whether the Managed Databases is encrypted.
engine This property is required. String
The Managed Database engine.
hostPrimary This property is required. String
The primary host for the Managed Database.
hostSecondary This property is required. String
The secondary/private network host for the Managed Database.
id This property is required. Integer
The ID of the Managed Database.
instanceUri This property is required. String
he API route for the database instance.
label This property is required. String
A unique, user-defined string referring to the Managed Database.
region This property is required. String
The region to use for the Managed Database.
replicationType This property is required. String
The replication method used for the Managed Database.
sslConnection This property is required. Boolean
Whether to require SSL credentials to establish a connection to the Managed Database.
status This property is required. String
The operating status of the Managed Database.
type This property is required. String
The Linode Instance type used for the nodes of the Managed Database instance.
updated This property is required. String
When this Managed Database was last updated.
version This property is required. String
The Managed Database engine version.
allowLists This property is required. string[]
A list of IP addresses that can access the Managed Database.
clusterSize This property is required. number
The number of Linode Instance nodes deployed to the Managed Database.
created This property is required. string
When this Managed Database was created.
encrypted This property is required. boolean
Whether the Managed Databases is encrypted.
engine This property is required. string
The Managed Database engine.
hostPrimary This property is required. string
The primary host for the Managed Database.
hostSecondary This property is required. string
The secondary/private network host for the Managed Database.
id This property is required. number
The ID of the Managed Database.
instanceUri This property is required. string
he API route for the database instance.
label This property is required. string
A unique, user-defined string referring to the Managed Database.
region This property is required. string
The region to use for the Managed Database.
replicationType This property is required. string
The replication method used for the Managed Database.
sslConnection This property is required. boolean
Whether to require SSL credentials to establish a connection to the Managed Database.
status This property is required. string
The operating status of the Managed Database.
type This property is required. string
The Linode Instance type used for the nodes of the Managed Database instance.
updated This property is required. string
When this Managed Database was last updated.
version This property is required. string
The Managed Database engine version.
allow_lists This property is required. Sequence[str]
A list of IP addresses that can access the Managed Database.
cluster_size This property is required. int
The number of Linode Instance nodes deployed to the Managed Database.
created This property is required. str
When this Managed Database was created.
encrypted This property is required. bool
Whether the Managed Databases is encrypted.
engine This property is required. str
The Managed Database engine.
host_primary This property is required. str
The primary host for the Managed Database.
host_secondary This property is required. str
The secondary/private network host for the Managed Database.
id This property is required. int
The ID of the Managed Database.
instance_uri This property is required. str
he API route for the database instance.
label This property is required. str
A unique, user-defined string referring to the Managed Database.
region This property is required. str
The region to use for the Managed Database.
replication_type This property is required. str
The replication method used for the Managed Database.
ssl_connection This property is required. bool
Whether to require SSL credentials to establish a connection to the Managed Database.
status This property is required. str
The operating status of the Managed Database.
type This property is required. str
The Linode Instance type used for the nodes of the Managed Database instance.
updated This property is required. str
When this Managed Database was last updated.
version This property is required. str
The Managed Database engine version.
allowLists This property is required. List<String>
A list of IP addresses that can access the Managed Database.
clusterSize This property is required. Number
The number of Linode Instance nodes deployed to the Managed Database.
created This property is required. String
When this Managed Database was created.
encrypted This property is required. Boolean
Whether the Managed Databases is encrypted.
engine This property is required. String
The Managed Database engine.
hostPrimary This property is required. String
The primary host for the Managed Database.
hostSecondary This property is required. String
The secondary/private network host for the Managed Database.
id This property is required. Number
The ID of the Managed Database.
instanceUri This property is required. String
he API route for the database instance.
label This property is required. String
A unique, user-defined string referring to the Managed Database.
region This property is required. String
The region to use for the Managed Database.
replicationType This property is required. String
The replication method used for the Managed Database.
sslConnection This property is required. Boolean
Whether to require SSL credentials to establish a connection to the Managed Database.
status This property is required. String
The operating status of the Managed Database.
type This property is required. String
The Linode Instance type used for the nodes of the Managed Database instance.
updated This property is required. String
When this Managed Database was last updated.
version This property is required. String
The Managed Database engine version.

GetDatabasesFilter

Name This property is required. string
The name of the field to filter by.
Values This property is required. List<string>
A list of values for the filter to allow. These values should all be in string form.
MatchBy string
The method to match the field by. (exact, regex, substring; default exact)
Name This property is required. string
The name of the field to filter by.
Values This property is required. []string
A list of values for the filter to allow. These values should all be in string form.
MatchBy string
The method to match the field by. (exact, regex, substring; default exact)
name This property is required. String
The name of the field to filter by.
values This property is required. List<String>
A list of values for the filter to allow. These values should all be in string form.
matchBy String
The method to match the field by. (exact, regex, substring; default exact)
name This property is required. string
The name of the field to filter by.
values This property is required. string[]
A list of values for the filter to allow. These values should all be in string form.
matchBy string
The method to match the field by. (exact, regex, substring; default exact)
name This property is required. str
The name of the field to filter by.
values This property is required. Sequence[str]
A list of values for the filter to allow. These values should all be in string form.
match_by str
The method to match the field by. (exact, regex, substring; default exact)
name This property is required. String
The name of the field to filter by.
values This property is required. List<String>
A list of values for the filter to allow. These values should all be in string form.
matchBy String
The method to match the field by. (exact, regex, substring; default exact)

Package Details

Repository
Linode pulumi/pulumi-linode
License
Apache-2.0
Notes
This Pulumi package is based on the linode Terraform Provider.
Linode v4.36.0 published on Thursday, Mar 27, 2025 by Pulumi