published on Thursday, May 14, 2026 by pulumiverse
published on Thursday, May 14, 2026 by pulumiverse
Create and manage Scaleway database privileges. For more information refer to the API documentation.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumiverse/scaleway";
const main = new scaleway.databases.Instance("main", {
name: "rdb",
nodeType: "DB-DEV-S",
engine: "PostgreSQL-11",
isHaCluster: true,
disableBackup: true,
userName: "my_initial_user",
password: "thiZ_is_v&ry_s3cret",
});
const mainDatabase = new scaleway.databases.Database("main", {
instanceId: main.id,
name: "database",
});
const mainUser = new scaleway.databases.User("main", {
instanceId: main.id,
name: "my-db-user",
password: "thiZ_is_v&ry_s3cret",
isAdmin: false,
});
const mainPrivilege = new scaleway.databases.Privilege("main", {
instanceId: main.id,
userName: mainUser.name,
databaseName: mainDatabase.name,
permission: "all",
});
import pulumi
import pulumiverse_scaleway as scaleway
main = scaleway.databases.Instance("main",
name="rdb",
node_type="DB-DEV-S",
engine="PostgreSQL-11",
is_ha_cluster=True,
disable_backup=True,
user_name="my_initial_user",
password="thiZ_is_v&ry_s3cret")
main_database = scaleway.databases.Database("main",
instance_id=main.id,
name="database")
main_user = scaleway.databases.User("main",
instance_id=main.id,
name="my-db-user",
password="thiZ_is_v&ry_s3cret",
is_admin=False)
main_privilege = scaleway.databases.Privilege("main",
instance_id=main.id,
user_name=main_user.name,
database_name=main_database.name,
permission="all")
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/databases"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
main, err := databases.NewInstance(ctx, "main", &databases.InstanceArgs{
Name: pulumi.String("rdb"),
NodeType: pulumi.String("DB-DEV-S"),
Engine: pulumi.String("PostgreSQL-11"),
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
}
mainDatabase, err := databases.NewDatabase(ctx, "main", &databases.DatabaseArgs{
InstanceId: main.ID(),
Name: pulumi.String("database"),
})
if err != nil {
return err
}
mainUser, err := databases.NewUser(ctx, "main", &databases.UserArgs{
InstanceId: main.ID(),
Name: pulumi.String("my-db-user"),
Password: pulumi.String("thiZ_is_v&ry_s3cret"),
IsAdmin: pulumi.Bool(false),
})
if err != nil {
return err
}
_, err = databases.NewPrivilege(ctx, "main", &databases.PrivilegeArgs{
InstanceId: main.ID(),
UserName: mainUser.Name,
DatabaseName: mainDatabase.Name,
Permission: pulumi.String("all"),
})
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.Databases.Instance("main", new()
{
Name = "rdb",
NodeType = "DB-DEV-S",
Engine = "PostgreSQL-11",
IsHaCluster = true,
DisableBackup = true,
UserName = "my_initial_user",
Password = "thiZ_is_v&ry_s3cret",
});
var mainDatabase = new Scaleway.Databases.Database("main", new()
{
InstanceId = main.Id,
Name = "database",
});
var mainUser = new Scaleway.Databases.User("main", new()
{
InstanceId = main.Id,
Name = "my-db-user",
Password = "thiZ_is_v&ry_s3cret",
IsAdmin = false,
});
var mainPrivilege = new Scaleway.Databases.Privilege("main", new()
{
InstanceId = main.Id,
UserName = mainUser.Name,
DatabaseName = mainDatabase.Name,
Permission = "all",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.databases.Instance;
import com.pulumi.scaleway.databases.InstanceArgs;
import com.pulumi.scaleway.databases.Database;
import com.pulumi.scaleway.databases.DatabaseArgs;
import com.pulumi.scaleway.databases.User;
import com.pulumi.scaleway.databases.UserArgs;
import com.pulumi.scaleway.databases.Privilege;
import com.pulumi.scaleway.databases.PrivilegeArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 Instance("main", InstanceArgs.builder()
.name("rdb")
.nodeType("DB-DEV-S")
.engine("PostgreSQL-11")
.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("database")
.build());
var mainUser = new User("mainUser", UserArgs.builder()
.instanceId(main.id())
.name("my-db-user")
.password("thiZ_is_v&ry_s3cret")
.isAdmin(false)
.build());
var mainPrivilege = new Privilege("mainPrivilege", PrivilegeArgs.builder()
.instanceId(main.id())
.userName(mainUser.name())
.databaseName(mainDatabase.name())
.permission("all")
.build());
}
}
resources:
main:
type: scaleway:databases:Instance
properties:
name: rdb
nodeType: DB-DEV-S
engine: PostgreSQL-11
isHaCluster: true
disableBackup: true
userName: my_initial_user
password: thiZ_is_v&ry_s3cret
mainDatabase:
type: scaleway:databases:Database
name: main
properties:
instanceId: ${main.id}
name: database
mainUser:
type: scaleway:databases:User
name: main
properties:
instanceId: ${main.id}
name: my-db-user
password: thiZ_is_v&ry_s3cret
isAdmin: false
mainPrivilege:
type: scaleway:databases:Privilege
name: main
properties:
instanceId: ${main.id}
userName: ${mainUser.name}
databaseName: ${mainDatabase.name}
permission: all
Example coming soon!
Permission Drift Management
Understanding Permission Drift
When you configure a privilege (e.g., readwrite), Scaleway applies it to database objects that exist at that moment. If new tables, views, or sequences are created later, they won’t automatically inherit these permissions. In that case, the API may return custom.
Example:
import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@pulumiverse/scaleway";
const app = new scaleway.databases.Privilege("app", {
instanceId: main.id,
userName: "app_user",
databaseName: "mydb",
permission: "readwrite",
});
import pulumi
import pulumiverse_scaleway as scaleway
app = scaleway.databases.Privilege("app",
instance_id=main["id"],
user_name="app_user",
database_name="mydb",
permission="readwrite")
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-scaleway/sdk/go/scaleway/databases"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := databases.NewPrivilege(ctx, "app", &databases.PrivilegeArgs{
InstanceId: pulumi.Any(main.Id),
UserName: pulumi.String("app_user"),
DatabaseName: pulumi.String("mydb"),
Permission: pulumi.String("readwrite"),
})
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 app = new Scaleway.Databases.Privilege("app", new()
{
InstanceId = main.Id,
UserName = "app_user",
DatabaseName = "mydb",
Permission = "readwrite",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.databases.Privilege;
import com.pulumi.scaleway.databases.PrivilegeArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 app = new Privilege("app", PrivilegeArgs.builder()
.instanceId(main.id())
.userName("app_user")
.databaseName("mydb")
.permission("readwrite")
.build());
}
}
resources:
app:
type: scaleway:databases:Privilege
properties:
instanceId: ${main.id}
userName: app_user
databaseName: mydb
permission: readwrite
Example coming soon!
Handling Permission Drift
Run pulumi up to reapply the configured permission to all objects (existing and new):
pulumi up
The plan will typically show:
~ resource "scaleway_rdb_privilege" "app" {
~ permission = "custom" -> "readwrite"
}
Create Privilege Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Privilege(name: string, args: PrivilegeArgs, opts?: CustomResourceOptions);@overload
def Privilege(resource_name: str,
args: PrivilegeArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Privilege(resource_name: str,
opts: Optional[ResourceOptions] = None,
database_name: Optional[str] = None,
instance_id: Optional[str] = None,
permission: Optional[str] = None,
user_name: Optional[str] = None,
region: Optional[str] = None)func NewPrivilege(ctx *Context, name string, args PrivilegeArgs, opts ...ResourceOption) (*Privilege, error)public Privilege(string name, PrivilegeArgs args, CustomResourceOptions? opts = null)
public Privilege(String name, PrivilegeArgs args)
public Privilege(String name, PrivilegeArgs args, CustomResourceOptions options)
type: scaleway:databases:Privilege
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "scaleway_databases_privilege" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args PrivilegeArgs
- 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 PrivilegeArgs
- 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 PrivilegeArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PrivilegeArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PrivilegeArgs
- 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 privilegeResource = new Scaleway.Databases.Privilege("privilegeResource", new()
{
DatabaseName = "string",
InstanceId = "string",
Permission = "string",
UserName = "string",
Region = "string",
});
example, err := databases.NewPrivilege(ctx, "privilegeResource", &databases.PrivilegeArgs{
DatabaseName: pulumi.String("string"),
InstanceId: pulumi.String("string"),
Permission: pulumi.String("string"),
UserName: pulumi.String("string"),
Region: pulumi.String("string"),
})
resource "scaleway_databases_privilege" "privilegeResource" {
database_name = "string"
instance_id = "string"
permission = "string"
user_name = "string"
region = "string"
}
var privilegeResource = new Privilege("privilegeResource", PrivilegeArgs.builder()
.databaseName("string")
.instanceId("string")
.permission("string")
.userName("string")
.region("string")
.build());
privilege_resource = scaleway.databases.Privilege("privilegeResource",
database_name="string",
instance_id="string",
permission="string",
user_name="string",
region="string")
const privilegeResource = new scaleway.databases.Privilege("privilegeResource", {
databaseName: "string",
instanceId: "string",
permission: "string",
userName: "string",
region: "string",
});
type: scaleway:databases:Privilege
properties:
databaseName: string
instanceId: string
permission: string
region: string
userName: string
Privilege 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 Privilege resource accepts the following input properties:
- Database
Name string - Name of the database (e.g.
my-db-name). - Instance
Id string - UUID of the Database Instance.
- Permission string
- Desired permission level. Valid values are
readonly,readwrite,all,customandnone. - User
Name string - Name of the user (e.g.
my-db-user). - Region string
region) The region in which the resource exists.
- Database
Name string - Name of the database (e.g.
my-db-name). - Instance
Id string - UUID of the Database Instance.
- Permission string
- Desired permission level. Valid values are
readonly,readwrite,all,customandnone. - User
Name string - Name of the user (e.g.
my-db-user). - Region string
region) The region in which the resource exists.
- database_
name string - Name of the database (e.g.
my-db-name). - instance_
id string - UUID of the Database Instance.
- permission string
- Desired permission level. Valid values are
readonly,readwrite,all,customandnone. - user_
name string - Name of the user (e.g.
my-db-user). - region string
region) The region in which the resource exists.
- database
Name String - Name of the database (e.g.
my-db-name). - instance
Id String - UUID of the Database Instance.
- permission String
- Desired permission level. Valid values are
readonly,readwrite,all,customandnone. - user
Name String - Name of the user (e.g.
my-db-user). - region String
region) The region in which the resource exists.
- database
Name string - Name of the database (e.g.
my-db-name). - instance
Id string - UUID of the Database Instance.
- permission string
- Desired permission level. Valid values are
readonly,readwrite,all,customandnone. - user
Name string - Name of the user (e.g.
my-db-user). - region string
region) The region in which the resource exists.
- database_
name str - Name of the database (e.g.
my-db-name). - instance_
id str - UUID of the Database Instance.
- permission str
- Desired permission level. Valid values are
readonly,readwrite,all,customandnone. - user_
name str - Name of the user (e.g.
my-db-user). - region str
region) The region in which the resource exists.
- database
Name String - Name of the database (e.g.
my-db-name). - instance
Id String - UUID of the Database Instance.
- permission String
- Desired permission level. Valid values are
readonly,readwrite,all,customandnone. - user
Name String - Name of the user (e.g.
my-db-user). - region String
region) The region in which the resource exists.
Outputs
All input properties are implicitly available as output properties. Additionally, the Privilege resource produces the following output properties:
- Effective
Permission string - The actual permission currently set in Scaleway. May differ from
permissionafter database schema changes (new tables, views, or sequences created). - Id string
- The provider-assigned unique ID for this managed resource.
- Permission
Status string - Permission synchronization status. Possible values:
- Effective
Permission string - The actual permission currently set in Scaleway. May differ from
permissionafter database schema changes (new tables, views, or sequences created). - Id string
- The provider-assigned unique ID for this managed resource.
- Permission
Status string - Permission synchronization status. Possible values:
- effective_
permission string - The actual permission currently set in Scaleway. May differ from
permissionafter database schema changes (new tables, views, or sequences created). - id string
- The provider-assigned unique ID for this managed resource.
- permission_
status string - Permission synchronization status. Possible values:
- effective
Permission String - The actual permission currently set in Scaleway. May differ from
permissionafter database schema changes (new tables, views, or sequences created). - id String
- The provider-assigned unique ID for this managed resource.
- permission
Status String - Permission synchronization status. Possible values:
- effective
Permission string - The actual permission currently set in Scaleway. May differ from
permissionafter database schema changes (new tables, views, or sequences created). - id string
- The provider-assigned unique ID for this managed resource.
- permission
Status string - Permission synchronization status. Possible values:
- effective_
permission str - The actual permission currently set in Scaleway. May differ from
permissionafter database schema changes (new tables, views, or sequences created). - id str
- The provider-assigned unique ID for this managed resource.
- permission_
status str - Permission synchronization status. Possible values:
- effective
Permission String - The actual permission currently set in Scaleway. May differ from
permissionafter database schema changes (new tables, views, or sequences created). - id String
- The provider-assigned unique ID for this managed resource.
- permission
Status String - Permission synchronization status. Possible values:
Look up Existing Privilege Resource
Get an existing Privilege 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?: PrivilegeState, opts?: CustomResourceOptions): Privilege@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
database_name: Optional[str] = None,
effective_permission: Optional[str] = None,
instance_id: Optional[str] = None,
permission: Optional[str] = None,
permission_status: Optional[str] = None,
region: Optional[str] = None,
user_name: Optional[str] = None) -> Privilegefunc GetPrivilege(ctx *Context, name string, id IDInput, state *PrivilegeState, opts ...ResourceOption) (*Privilege, error)public static Privilege Get(string name, Input<string> id, PrivilegeState? state, CustomResourceOptions? opts = null)public static Privilege get(String name, Output<String> id, PrivilegeState state, CustomResourceOptions options)resources: _: type: scaleway:databases:Privilege get: id: ${id}import {
to = scaleway_databases_privilege.example
id = "${id}"
}
- 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.
- Database
Name string - Name of the database (e.g.
my-db-name). - Effective
Permission string - The actual permission currently set in Scaleway. May differ from
permissionafter database schema changes (new tables, views, or sequences created). - Instance
Id string - UUID of the Database Instance.
- Permission string
- Desired permission level. Valid values are
readonly,readwrite,all,customandnone. - Permission
Status string - Permission synchronization status. Possible values:
- Region string
region) The region in which the resource exists.- User
Name string - Name of the user (e.g.
my-db-user).
- Database
Name string - Name of the database (e.g.
my-db-name). - Effective
Permission string - The actual permission currently set in Scaleway. May differ from
permissionafter database schema changes (new tables, views, or sequences created). - Instance
Id string - UUID of the Database Instance.
- Permission string
- Desired permission level. Valid values are
readonly,readwrite,all,customandnone. - Permission
Status string - Permission synchronization status. Possible values:
- Region string
region) The region in which the resource exists.- User
Name string - Name of the user (e.g.
my-db-user).
- database_
name string - Name of the database (e.g.
my-db-name). - effective_
permission string - The actual permission currently set in Scaleway. May differ from
permissionafter database schema changes (new tables, views, or sequences created). - instance_
id string - UUID of the Database Instance.
- permission string
- Desired permission level. Valid values are
readonly,readwrite,all,customandnone. - permission_
status string - Permission synchronization status. Possible values:
- region string
region) The region in which the resource exists.- user_
name string - Name of the user (e.g.
my-db-user).
- database
Name String - Name of the database (e.g.
my-db-name). - effective
Permission String - The actual permission currently set in Scaleway. May differ from
permissionafter database schema changes (new tables, views, or sequences created). - instance
Id String - UUID of the Database Instance.
- permission String
- Desired permission level. Valid values are
readonly,readwrite,all,customandnone. - permission
Status String - Permission synchronization status. Possible values:
- region String
region) The region in which the resource exists.- user
Name String - Name of the user (e.g.
my-db-user).
- database
Name string - Name of the database (e.g.
my-db-name). - effective
Permission string - The actual permission currently set in Scaleway. May differ from
permissionafter database schema changes (new tables, views, or sequences created). - instance
Id string - UUID of the Database Instance.
- permission string
- Desired permission level. Valid values are
readonly,readwrite,all,customandnone. - permission
Status string - Permission synchronization status. Possible values:
- region string
region) The region in which the resource exists.- user
Name string - Name of the user (e.g.
my-db-user).
- database_
name str - Name of the database (e.g.
my-db-name). - effective_
permission str - The actual permission currently set in Scaleway. May differ from
permissionafter database schema changes (new tables, views, or sequences created). - instance_
id str - UUID of the Database Instance.
- permission str
- Desired permission level. Valid values are
readonly,readwrite,all,customandnone. - permission_
status str - Permission synchronization status. Possible values:
- region str
region) The region in which the resource exists.- user_
name str - Name of the user (e.g.
my-db-user).
- database
Name String - Name of the database (e.g.
my-db-name). - effective
Permission String - The actual permission currently set in Scaleway. May differ from
permissionafter database schema changes (new tables, views, or sequences created). - instance
Id String - UUID of the Database Instance.
- permission String
- Desired permission level. Valid values are
readonly,readwrite,all,customandnone. - permission
Status String - Permission synchronization status. Possible values:
- region String
region) The region in which the resource exists.- user
Name String - Name of the user (e.g.
my-db-user).
Import
The user privileges can be imported using the {region}/{instance_id}/{database_name}/{user_name}, e.g.
$ pulumi import scaleway:databases/privilege:Privilege o fr-par/11111111-1111-1111-1111-111111111111/database_name/foo
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
scalewayTerraform Provider.
published on Thursday, May 14, 2026 by pulumiverse
