Scaleway

v1.4.0 published on Monday, Nov 28, 2022 by lbrlabs

DatabasePrivilege

Create and manage Scaleway RDB database privilege. For more information, see the documentation.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Scaleway = Lbrlabs.PulumiPackage.Scaleway;

return await Deployment.RunAsync(() => 
{
    var mainDatabaseUser = new Scaleway.DatabaseUser("mainDatabaseUser", new()
    {
        InstanceId = scaleway_rdb_instance.Pgsql.Id,
        Password = "thiZ_is_v&ry_s3cret",
        IsAdmin = false,
    });

    var mainDatabase = new Scaleway.Database("mainDatabase", new()
    {
        InstanceId = scaleway_rdb_instance.Pgsql.Id,
    });

    var priv = new Scaleway.DatabasePrivilege("priv", new()
    {
        InstanceId = scaleway_rdb_instance.Rdb.Id,
        UserName = "my-db-user",
        DatabaseName = "my-db-name",
        Permission = "all",
    }, new CustomResourceOptions
    {
        DependsOn = new[]
        {
            mainDatabaseUser,
            mainDatabase,
        },
    });

});
package main

import (
	"github.com/lbrlabs/pulumi-scaleway/sdk/go/scaleway"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		mainDatabaseUser, err := scaleway.NewDatabaseUser(ctx, "mainDatabaseUser", &scaleway.DatabaseUserArgs{
			InstanceId: pulumi.Any(scaleway_rdb_instance.Pgsql.Id),
			Password:   pulumi.String("thiZ_is_v&ry_s3cret"),
			IsAdmin:    pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		mainDatabase, err := scaleway.NewDatabase(ctx, "mainDatabase", &scaleway.DatabaseArgs{
			InstanceId: pulumi.Any(scaleway_rdb_instance.Pgsql.Id),
		})
		if err != nil {
			return err
		}
		_, err = scaleway.NewDatabasePrivilege(ctx, "priv", &scaleway.DatabasePrivilegeArgs{
			InstanceId:   pulumi.Any(scaleway_rdb_instance.Rdb.Id),
			UserName:     pulumi.String("my-db-user"),
			DatabaseName: pulumi.String("my-db-name"),
			Permission:   pulumi.String("all"),
		}, pulumi.DependsOn([]pulumi.Resource{
			mainDatabaseUser,
			mainDatabase,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.scaleway.DatabaseUser;
import com.pulumi.scaleway.DatabaseUserArgs;
import com.pulumi.scaleway.Database;
import com.pulumi.scaleway.DatabaseArgs;
import com.pulumi.scaleway.DatabasePrivilege;
import com.pulumi.scaleway.DatabasePrivilegeArgs;
import com.pulumi.resources.CustomResourceOptions;
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 mainDatabaseUser = new DatabaseUser("mainDatabaseUser", DatabaseUserArgs.builder()        
            .instanceId(scaleway_rdb_instance.pgsql().id())
            .password("thiZ_is_v&ry_s3cret")
            .isAdmin(false)
            .build());

        var mainDatabase = new Database("mainDatabase", DatabaseArgs.builder()        
            .instanceId(scaleway_rdb_instance.pgsql().id())
            .build());

        var priv = new DatabasePrivilege("priv", DatabasePrivilegeArgs.builder()        
            .instanceId(scaleway_rdb_instance.rdb().id())
            .userName("my-db-user")
            .databaseName("my-db-name")
            .permission("all")
            .build(), CustomResourceOptions.builder()
                .dependsOn(                
                    mainDatabaseUser,
                    mainDatabase)
                .build());

    }
}
import pulumi
import lbrlabs_pulumi_scaleway as scaleway

main_database_user = scaleway.DatabaseUser("mainDatabaseUser",
    instance_id=scaleway_rdb_instance["pgsql"]["id"],
    password="thiZ_is_v&ry_s3cret",
    is_admin=False)
main_database = scaleway.Database("mainDatabase", instance_id=scaleway_rdb_instance["pgsql"]["id"])
priv = scaleway.DatabasePrivilege("priv",
    instance_id=scaleway_rdb_instance["rdb"]["id"],
    user_name="my-db-user",
    database_name="my-db-name",
    permission="all",
    opts=pulumi.ResourceOptions(depends_on=[
            main_database_user,
            main_database,
        ]))
import * as pulumi from "@pulumi/pulumi";
import * as scaleway from "@lbrlabs/pulumi-scaleway";

const mainDatabaseUser = new scaleway.DatabaseUser("mainDatabaseUser", {
    instanceId: scaleway_rdb_instance.pgsql.id,
    password: "thiZ_is_v&ry_s3cret",
    isAdmin: false,
});
const mainDatabase = new scaleway.Database("mainDatabase", {instanceId: scaleway_rdb_instance.pgsql.id});
const priv = new scaleway.DatabasePrivilege("priv", {
    instanceId: scaleway_rdb_instance.rdb.id,
    userName: "my-db-user",
    databaseName: "my-db-name",
    permission: "all",
}, {
    dependsOn: [
        mainDatabaseUser,
        mainDatabase,
    ],
});
resources:
  priv:
    type: scaleway:DatabasePrivilege
    properties:
      instanceId: ${scaleway_rdb_instance.rdb.id}
      userName: my-db-user
      databaseName: my-db-name
      permission: all
    options:
      dependson:
        - ${mainDatabaseUser}
        - ${mainDatabase}
  mainDatabaseUser:
    type: scaleway:DatabaseUser
    properties:
      instanceId: ${scaleway_rdb_instance.pgsql.id}
      password: thiZ_is_v&ry_s3cret
      isAdmin: false
  mainDatabase:
    type: scaleway:Database
    properties:
      instanceId: ${scaleway_rdb_instance.pgsql.id}

Create DatabasePrivilege Resource

new DatabasePrivilege(name: string, args: DatabasePrivilegeArgs, opts?: CustomResourceOptions);
@overload
def DatabasePrivilege(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)
@overload
def DatabasePrivilege(resource_name: str,
                      args: DatabasePrivilegeArgs,
                      opts: Optional[ResourceOptions] = None)
func NewDatabasePrivilege(ctx *Context, name string, args DatabasePrivilegeArgs, opts ...ResourceOption) (*DatabasePrivilege, error)
public DatabasePrivilege(string name, DatabasePrivilegeArgs args, CustomResourceOptions? opts = null)
public DatabasePrivilege(String name, DatabasePrivilegeArgs args)
public DatabasePrivilege(String name, DatabasePrivilegeArgs args, CustomResourceOptions options)
type: scaleway:DatabasePrivilege
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args DatabasePrivilegeArgs
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 DatabasePrivilegeArgs
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 DatabasePrivilegeArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args DatabasePrivilegeArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args DatabasePrivilegeArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

DatabasePrivilege Resource Properties

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

Inputs

The DatabasePrivilege resource accepts the following input properties:

DatabaseName string

Name of the database (e.g. my-db-name).

InstanceId string

UUID of the instance where to create the database.

Permission string

Permission to set. Valid values are readonly, readwrite, all, custom and none.

UserName string

Name of the user (e.g. my-db-user).

DatabaseName string

Name of the database (e.g. my-db-name).

InstanceId string

UUID of the instance where to create the database.

Permission string

Permission to set. Valid values are readonly, readwrite, all, custom and none.

UserName string

Name of the user (e.g. my-db-user).

databaseName String

Name of the database (e.g. my-db-name).

instanceId String

UUID of the instance where to create the database.

permission String

Permission to set. Valid values are readonly, readwrite, all, custom and none.

userName String

Name of the user (e.g. my-db-user).

databaseName string

Name of the database (e.g. my-db-name).

instanceId string

UUID of the instance where to create the database.

permission string

Permission to set. Valid values are readonly, readwrite, all, custom and none.

userName string

Name of the user (e.g. my-db-user).

database_name str

Name of the database (e.g. my-db-name).

instance_id str

UUID of the instance where to create the database.

permission str

Permission to set. Valid values are readonly, readwrite, all, custom and none.

user_name str

Name of the user (e.g. my-db-user).

databaseName String

Name of the database (e.g. my-db-name).

instanceId String

UUID of the instance where to create the database.

permission String

Permission to set. Valid values are readonly, readwrite, all, custom and none.

userName String

Name of the user (e.g. my-db-user).

Outputs

All input properties are implicitly available as output properties. Additionally, the DatabasePrivilege 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 string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing DatabasePrivilege Resource

Get an existing DatabasePrivilege 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?: DatabasePrivilegeState, opts?: CustomResourceOptions): DatabasePrivilege
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        database_name: Optional[str] = None,
        instance_id: Optional[str] = None,
        permission: Optional[str] = None,
        user_name: Optional[str] = None) -> DatabasePrivilege
func GetDatabasePrivilege(ctx *Context, name string, id IDInput, state *DatabasePrivilegeState, opts ...ResourceOption) (*DatabasePrivilege, error)
public static DatabasePrivilege Get(string name, Input<string> id, DatabasePrivilegeState? state, CustomResourceOptions? opts = null)
public static DatabasePrivilege get(String name, Output<String> id, DatabasePrivilegeState 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.
The following state arguments are supported:
DatabaseName string

Name of the database (e.g. my-db-name).

InstanceId string

UUID of the instance where to create the database.

Permission string

Permission to set. Valid values are readonly, readwrite, all, custom and none.

UserName string

Name of the user (e.g. my-db-user).

DatabaseName string

Name of the database (e.g. my-db-name).

InstanceId string

UUID of the instance where to create the database.

Permission string

Permission to set. Valid values are readonly, readwrite, all, custom and none.

UserName string

Name of the user (e.g. my-db-user).

databaseName String

Name of the database (e.g. my-db-name).

instanceId String

UUID of the instance where to create the database.

permission String

Permission to set. Valid values are readonly, readwrite, all, custom and none.

userName String

Name of the user (e.g. my-db-user).

databaseName string

Name of the database (e.g. my-db-name).

instanceId string

UUID of the instance where to create the database.

permission string

Permission to set. Valid values are readonly, readwrite, all, custom and none.

userName string

Name of the user (e.g. my-db-user).

database_name str

Name of the database (e.g. my-db-name).

instance_id str

UUID of the instance where to create the database.

permission str

Permission to set. Valid values are readonly, readwrite, all, custom and none.

user_name str

Name of the user (e.g. my-db-user).

databaseName String

Name of the database (e.g. my-db-name).

instanceId String

UUID of the instance where to create the database.

permission String

Permission to set. Valid values are readonly, readwrite, all, custom and none.

userName String

Name of the user (e.g. my-db-user).

Package Details

Repository
https://github.com/lbrlabs/pulumi-scaleway
License
Apache-2.0
Notes

This Pulumi package is based on the scaleway Terraform Provider.