Class DatabaseUser
Provides a DigitalOcean database user resource. When creating a new database cluster, a default admin user with name doadmin will be created. Then, this resource can be used to provide additional normal users inside the cluster.
NOTE: Any new users created will always have
normalrole, only the default user that comes with database cluster creation hasprimaryrole. Additional permissions must be managed manually.
Example Usage
Create a new PostgreSQL database user
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
class MyStack : Stack
{
public MyStack()
{
var postgres_example = new DigitalOcean.DatabaseCluster("postgres-example", new DigitalOcean.DatabaseClusterArgs
{
Engine = "pg",
Version = "11",
Size = "db-s-1vcpu-1gb",
Region = "nyc1",
NodeCount = 1,
});
var user_example = new DigitalOcean.DatabaseUser("user-example", new DigitalOcean.DatabaseUserArgs
{
ClusterId = postgres_example.Id,
});
}
}
Inherited Members
Namespace: Pulumi.DigitalOcean
Assembly: Pulumi.DigitalOcean.dll
Syntax
public class DatabaseUser : CustomResource
Constructors
View SourceDatabaseUser(String, DatabaseUserArgs, CustomResourceOptions)
Create a DatabaseUser resource with the given unique name, arguments, and options.
Declaration
public DatabaseUser(string name, DatabaseUserArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| DatabaseUserArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceClusterId
The ID of the original source database cluster.
Declaration
public Output<string> ClusterId { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
MysqlAuthPlugin
The authentication method to use for connections to the MySQL user account. The valid values are mysql_native_password or caching_sha2_password (this is the default).
Declaration
public Output<string> MysqlAuthPlugin { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Name
The name for the database user.
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Password
Password for the database user.
Declaration
public Output<string> Password { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Role
Role for the database user. The value will be either "primary" or "normal".
Declaration
public Output<string> Role { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Methods
View SourceGet(String, Input<String>, DatabaseUserState, CustomResourceOptions)
Get an existing DatabaseUser resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static DatabaseUser Get(string name, Input<string> id, DatabaseUserState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| DatabaseUserState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| DatabaseUser |