Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

Database

# Database Resource

The Database resource allows the creation and management of Aiven Databases.

Example Usage

using Pulumi;
using Aiven = Pulumi.Aiven;

class MyStack : Stack
{
    public MyStack()
    {
        var mydatabase = new Aiven.Database("mydatabase", new Aiven.DatabaseArgs
        {
            DatabaseName = "<DATABASE_NAME>",
            Project = aiven_project.Myproject.Project,
            ServiceName = aiven_service.Myservice.Service_name,
        });
    }

}
package main

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

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := aiven.NewDatabase(ctx, "mydatabase", &aiven.DatabaseArgs{
            DatabaseName: pulumi.String("<DATABASE_NAME>"),
            Project:      pulumi.Any(aiven_project.Myproject.Project),
            ServiceName:  pulumi.Any(aiven_service.Myservice.Service_name),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aiven as aiven

mydatabase = aiven.Database("mydatabase",
    database_name="<DATABASE_NAME>",
    project=aiven_project["myproject"]["project"],
    service_name=aiven_service["myservice"]["service_name"])
import * as pulumi from "@pulumi/pulumi";
import * as aiven from "@pulumi/aiven";

const mydatabase = new aiven.Database("mydatabase", {
    databaseName: "<DATABASE_NAME>",
    project: aiven_project_myproject.project,
    serviceName: aiven_service_myservice.serviceName,
});

Create a Database Resource

new Database(name: string, args: DatabaseArgs, opts?: CustomResourceOptions);
def Database(resource_name: str, opts: Optional[ResourceOptions] = None, database_name: Optional[str] = None, lc_collate: Optional[str] = None, lc_ctype: Optional[str] = None, project: Optional[str] = None, service_name: Optional[str] = None, termination_protection: Optional[bool] = None)
func NewDatabase(ctx *Context, name string, args DatabaseArgs, opts ...ResourceOption) (*Database, error)
public Database(string name, DatabaseArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args DatabaseArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args DatabaseArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args DatabaseArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Database Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The Database resource accepts the following input properties:

DatabaseName string

is the actual name of the database.

Project string

and service_name - (Required) define the project and service the database belongs to. They should be defined using reference as shown above to set up dependencies correctly.

ServiceName string

Service to link the database to

LcCollate string

default string sort order (LC_COLLATE) of the database. Default value: en_US.UTF-8.

LcCtype string

default character classification (LC_CTYPE) of the database. Default value: en_US.UTF-8.

TerminationProtection bool

It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data.

DatabaseName string

is the actual name of the database.

Project string

and service_name - (Required) define the project and service the database belongs to. They should be defined using reference as shown above to set up dependencies correctly.

ServiceName string

Service to link the database to

LcCollate string

default string sort order (LC_COLLATE) of the database. Default value: en_US.UTF-8.

LcCtype string

default character classification (LC_CTYPE) of the database. Default value: en_US.UTF-8.

TerminationProtection bool

It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data.

databaseName string

is the actual name of the database.

project string

and service_name - (Required) define the project and service the database belongs to. They should be defined using reference as shown above to set up dependencies correctly.

serviceName string

Service to link the database to

lcCollate string

default string sort order (LC_COLLATE) of the database. Default value: en_US.UTF-8.

lcCtype string

default character classification (LC_CTYPE) of the database. Default value: en_US.UTF-8.

terminationProtection boolean

It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data.

database_name str

is the actual name of the database.

project str

and service_name - (Required) define the project and service the database belongs to. They should be defined using reference as shown above to set up dependencies correctly.

service_name str

Service to link the database to

lc_collate str

default string sort order (LC_COLLATE) of the database. Default value: en_US.UTF-8.

lc_ctype str

default character classification (LC_CTYPE) of the database. Default value: en_US.UTF-8.

termination_protection bool

It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data.

Outputs

All input properties are implicitly available as output properties. Additionally, the Database resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.

Look up an Existing Database Resource

Get an existing Database resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: DatabaseState, opts?: CustomResourceOptions): Database
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, database_name: Optional[str] = None, lc_collate: Optional[str] = None, lc_ctype: Optional[str] = None, project: Optional[str] = None, service_name: Optional[str] = None, termination_protection: Optional[bool] = None) -> Database
func GetDatabase(ctx *Context, name string, id IDInput, state *DatabaseState, opts ...ResourceOption) (*Database, error)
public static Database Get(string name, Input<string> id, DatabaseState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

DatabaseName string

is the actual name of the database.

LcCollate string

default string sort order (LC_COLLATE) of the database. Default value: en_US.UTF-8.

LcCtype string

default character classification (LC_CTYPE) of the database. Default value: en_US.UTF-8.

Project string

and service_name - (Required) define the project and service the database belongs to. They should be defined using reference as shown above to set up dependencies correctly.

ServiceName string

Service to link the database to

TerminationProtection bool

It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data.

DatabaseName string

is the actual name of the database.

LcCollate string

default string sort order (LC_COLLATE) of the database. Default value: en_US.UTF-8.

LcCtype string

default character classification (LC_CTYPE) of the database. Default value: en_US.UTF-8.

Project string

and service_name - (Required) define the project and service the database belongs to. They should be defined using reference as shown above to set up dependencies correctly.

ServiceName string

Service to link the database to

TerminationProtection bool

It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data.

databaseName string

is the actual name of the database.

lcCollate string

default string sort order (LC_COLLATE) of the database. Default value: en_US.UTF-8.

lcCtype string

default character classification (LC_CTYPE) of the database. Default value: en_US.UTF-8.

project string

and service_name - (Required) define the project and service the database belongs to. They should be defined using reference as shown above to set up dependencies correctly.

serviceName string

Service to link the database to

terminationProtection boolean

It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data.

database_name str

is the actual name of the database.

lc_collate str

default string sort order (LC_COLLATE) of the database. Default value: en_US.UTF-8.

lc_ctype str

default character classification (LC_CTYPE) of the database. Default value: en_US.UTF-8.

project str

and service_name - (Required) define the project and service the database belongs to. They should be defined using reference as shown above to set up dependencies correctly.

service_name str

Service to link the database to

termination_protection bool

It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data.

Package Details

Repository
https://github.com/pulumi/pulumi-aiven
License
Apache-2.0
Notes
This Pulumi package is based on the aiven Terraform Provider.