scaleway.Database
Explore with Pulumi AI
Creates and manages databases. For more information, refer to the API documentation.
Example Usage
Basic
import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumiverse/scaleway";
const main = new scaleway.DatabaseInstance("main", {
name: "test-rdb",
nodeType: "DB-DEV-S",
engine: "PostgreSQL-15",
isHaCluster: true,
disableBackup: true,
userName: "my_initial_user",
password: "thiZ_is_v&ry_s3cret",
});
const mainDatabase = new scaleway.Database("main", {
instanceId: main.id,
name: "my-new-database",
});
import pulumi
import pulumiverse_scaleway as scaleway
main = scaleway.DatabaseInstance("main",
name="test-rdb",
node_type="DB-DEV-S",
engine="PostgreSQL-15",
is_ha_cluster=True,
disable_backup=True,
user_name="my_initial_user",
password="thiZ_is_v&ry_s3cret")
main_database = scaleway.Database("main",
instance_id=main.id,
name="my-new-database")
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
main, err := scaleway.NewDatabaseInstance(ctx, "main", &scaleway.DatabaseInstanceArgs{
Name: pulumi.String("test-rdb"),
NodeType: pulumi.String("DB-DEV-S"),
Engine: pulumi.String("PostgreSQL-15"),
IsHaCluster: pulumi.Bool(true),
DisableBackup: pulumi.Bool(true),
UserName: pulumi.String("my_initial_user"),
Password: pulumi.String("thiZ_is_v&ry_s3cret"),
})
if err != nil {
return err
}
_, err = scaleway.NewDatabase(ctx, "main", &scaleway.DatabaseArgs{
InstanceId: main.ID(),
Name: pulumi.String("my-new-database"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Scaleway = Pulumiverse.Scaleway;
return await Deployment.RunAsync(() =>
{
var main = new Scaleway.DatabaseInstance("main", new()
{
Name = "test-rdb",
NodeType = "DB-DEV-S",
Engine = "PostgreSQL-15",
IsHaCluster = true,
DisableBackup = true,
UserName = "my_initial_user",
Password = "thiZ_is_v&ry_s3cret",
});
var mainDatabase = new Scaleway.Database("main", new()
{
InstanceId = main.Id,
Name = "my-new-database",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.DatabaseInstance;
import com.pulumi.scaleway.DatabaseInstanceArgs;
import com.pulumi.scaleway.Database;
import com.pulumi.scaleway.DatabaseArgs;
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) {
var main = new DatabaseInstance("main", DatabaseInstanceArgs.builder()
.name("test-rdb")
.nodeType("DB-DEV-S")
.engine("PostgreSQL-15")
.isHaCluster(true)
.disableBackup(true)
.userName("my_initial_user")
.password("thiZ_is_v&ry_s3cret")
.build());
var mainDatabase = new Database("mainDatabase", DatabaseArgs.builder()
.instanceId(main.id())
.name("my-new-database")
.build());
}
}
resources:
main:
type: scaleway:DatabaseInstance
properties:
name: test-rdb
nodeType: DB-DEV-S
engine: PostgreSQL-15
isHaCluster: true
disableBackup: true
userName: my_initial_user
password: thiZ_is_v&ry_s3cret
mainDatabase:
type: scaleway:Database
name: main
properties:
instanceId: ${main.id}
name: my-new-database
Create Database Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Database(name: string, args: DatabaseArgs, opts?: CustomResourceOptions);
@overload
def Database(resource_name: str,
args: DatabaseArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Database(resource_name: str,
opts: Optional[ResourceOptions] = None,
instance_id: Optional[str] = None,
name: Optional[str] = None,
region: Optional[str] = None)
func NewDatabase(ctx *Context, name string, args DatabaseArgs, opts ...ResourceOption) (*Database, error)
public Database(string name, DatabaseArgs args, CustomResourceOptions? opts = null)
public Database(String name, DatabaseArgs args)
public Database(String name, DatabaseArgs args, CustomResourceOptions options)
type: scaleway:Database
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- 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.
- args DatabaseArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control 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.
- name String
- The unique name of the resource.
- args DatabaseArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var databaseResource = new Scaleway.Database("databaseResource", new()
{
InstanceId = "string",
Name = "string",
Region = "string",
});
example, err := scaleway.NewDatabase(ctx, "databaseResource", &scaleway.DatabaseArgs{
InstanceId: pulumi.String("string"),
Name: pulumi.String("string"),
Region: pulumi.String("string"),
})
var databaseResource = new Database("databaseResource", DatabaseArgs.builder()
.instanceId("string")
.name("string")
.region("string")
.build());
database_resource = scaleway.Database("databaseResource",
instance_id="string",
name="string",
region="string")
const databaseResource = new scaleway.Database("databaseResource", {
instanceId: "string",
name: "string",
region: "string",
});
type: scaleway:Database
properties:
instanceId: string
name: string
region: string
Database Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Database resource accepts the following input properties:
- Instance
Id string UUID of the Database Instance.
Important: Updates to
instance_id
will recreate the database.- Name string
- Name of the database (e.g.
my-new-database
). - Region string
region
) The region in which the resource exists.
- Instance
Id string UUID of the Database Instance.
Important: Updates to
instance_id
will recreate the database.- Name string
- Name of the database (e.g.
my-new-database
). - Region string
region
) The region in which the resource exists.
- instance
Id String UUID of the Database Instance.
Important: Updates to
instance_id
will recreate the database.- name String
- Name of the database (e.g.
my-new-database
). - region String
region
) The region in which the resource exists.
- instance
Id string UUID of the Database Instance.
Important: Updates to
instance_id
will recreate the database.- name string
- Name of the database (e.g.
my-new-database
). - region string
region
) The region in which the resource exists.
- instance_
id str UUID of the Database Instance.
Important: Updates to
instance_id
will recreate the database.- name str
- Name of the database (e.g.
my-new-database
). - region str
region
) The region in which the resource exists.
- instance
Id String UUID of the Database Instance.
Important: Updates to
instance_id
will recreate the database.- name String
- Name of the database (e.g.
my-new-database
). - region String
region
) The region in which the resource exists.
Outputs
All input properties are implicitly available as output properties. Additionally, the Database resource produces the following output properties:
Look up 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,
instance_id: Optional[str] = None,
managed: Optional[bool] = None,
name: Optional[str] = None,
owner: Optional[str] = None,
region: Optional[str] = None,
size: Optional[str] = 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)
public static Database get(String name, Output<String> id, DatabaseState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- 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.
- Instance
Id string UUID of the Database Instance.
Important: Updates to
instance_id
will recreate the database.- Managed bool
- Whether the database is managed or not.
- Name string
- Name of the database (e.g.
my-new-database
). - Owner string
- The name of the owner of the database.
- Region string
region
) The region in which the resource exists.- Size string
- Size of the database (in bytes).
- Instance
Id string UUID of the Database Instance.
Important: Updates to
instance_id
will recreate the database.- Managed bool
- Whether the database is managed or not.
- Name string
- Name of the database (e.g.
my-new-database
). - Owner string
- The name of the owner of the database.
- Region string
region
) The region in which the resource exists.- Size string
- Size of the database (in bytes).
- instance
Id String UUID of the Database Instance.
Important: Updates to
instance_id
will recreate the database.- managed Boolean
- Whether the database is managed or not.
- name String
- Name of the database (e.g.
my-new-database
). - owner String
- The name of the owner of the database.
- region String
region
) The region in which the resource exists.- size String
- Size of the database (in bytes).
- instance
Id string UUID of the Database Instance.
Important: Updates to
instance_id
will recreate the database.- managed boolean
- Whether the database is managed or not.
- name string
- Name of the database (e.g.
my-new-database
). - owner string
- The name of the owner of the database.
- region string
region
) The region in which the resource exists.- size string
- Size of the database (in bytes).
- instance_
id str UUID of the Database Instance.
Important: Updates to
instance_id
will recreate the database.- managed bool
- Whether the database is managed or not.
- name str
- Name of the database (e.g.
my-new-database
). - owner str
- The name of the owner of the database.
- region str
region
) The region in which the resource exists.- size str
- Size of the database (in bytes).
- instance
Id String UUID of the Database Instance.
Important: Updates to
instance_id
will recreate the database.- managed Boolean
- Whether the database is managed or not.
- name String
- Name of the database (e.g.
my-new-database
). - owner String
- The name of the owner of the database.
- region String
region
) The region in which the resource exists.- size String
- Size of the database (in bytes).
Import
RDB Database can be imported using the {region}/{id}/{DBNAME}
, e.g.
bash
$ pulumi import scaleway:index/database:Database rdb01_mydb fr-par/11111111-1111-1111-1111-111111111111/mydb
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- scaleway pulumiverse/pulumi-scaleway
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
scaleway
Terraform Provider.