Terraform module to create Databases using Scaleway's Managed Databases.
Create and configure the following:
- Managed RDB Instances
- Database Users
- Database ACLs
- Managed Databases
The module takes a map
of objects for each database to configure.
# example with a single RDB instance configured with 2 managed databases
module "database" {
source = "particuleio/database/scaleway"
version = "1.2.0" # use latest version
databases = {
main = {
node_type = "DB-DEV-S"
engine = "PostgreSQL-11"
dbs = ["default", "core"]
}
}
}
The locals.tf
defines default values that are merged and overriden
by each database
definition in the databases
map
.
Multiple examples are available in the ./examples
directory.
- A simple database setup
- Multiple database creation with users
- Database creation with ACL support
- RDB instance with multiple databases
Below is an advanced usage of this module.
module "database" {
source = "particuleio/database/scaleway"
version = "1.2.0" # use latest version
databases = {
main = {
name = "database-with-multiple-dbs"
node_type = "DB-DEV-S"
engine = "PostgreSQL-11"
dbs = ["default", "admin", "internal"]
acls = [
{
ip = "1.2.3.4/32"
description = "Specific ACL 1"
},
{
ip = "192.168.1.20/28"
description = "Specific ACL 2"
},
]
users = [
{
username = "application"
password_length = 16
is_admin = false
},
{
username = "administrator"
password_length = 24
is_admin = true
},
]
}
metrics = { # second RDB instance definition
name = "simple-database"
node_type = "DB-DEV-S"
engine = "PostgreSQL-11"
}
}
}
Name | Version |
---|---|
terraform | >= 0.13 |
scaleway | ~> 2.0 |
Name | Version |
---|---|
random | n/a |
scaleway | ~> 2.0 |
No modules.
Name | Type |
---|---|
random_password.this | resource |
scaleway_rdb_acl.this | resource |
scaleway_rdb_database.this | resource |
scaleway_rdb_instance.this | resource |
scaleway_rdb_user.this | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
databases | The scaleway Database configurations | map(any) |
n/a | yes |
region | Region to be used with the scaleway provider | string |
"fr-par" |
no |
zone | Zone to be used with the scaleway provider | string |
"fr-par-1" |
no |
Name | Description |
---|---|
databases | A map of each created scaleway_rdb_instance with each var.databases definition as key |
instances | A map of each created scaleway_rdb_instance with each var.databases definition as key |
this | A map of the scaleway_rdb_database (including their users) and scaleway_rdb_instance resources grouped by databases definitions |